I have a simple application (just one .py file), that is using cherrypy & flask-restful to present a web service. My development environment is Windows. I use Python 3.5.2 and also create and use virtualenv to work on my project.
I have a need to deploy this on Linux systems. I was asked to create a "RPM" for this so that it can be installed and run on Linux machines.
I have googled and read several pieces of documentation:
But I'm very unclear on the steps that needs to be done to deploy this on a Linux system. Thanks in advance for all your help.
The rpm-python package contains a module that permits applications written in the Python programming language to use the interface supplied by RPM Package Manager libraries. This package should be installed if you want to develop Python programs that will manipulate RPM packages and databases.
The RPM database and Python Python is a great default language for system administrators, and the RPM database comes with bindings that make it easy to query with Python. [ Sign up for the free online course Red Hat Enterprise Linux Technical Overview. ]
This is a mini demo structure output by tree
command, color_print
is the package name and directory
.
├── color_print
│ ├── color_print.py
│ └── __init__.py
├── __init__.py
└── setup.py
Here is an example setup.py
for demo
from setuptools import setup
setup(name='color_print',
version='0.1',
description='Color String',
url='http://github/xxxx/color_print/',
author='Joe Bob',
author_email='[email protected]',
license='MIT',
packages=['color_print'],
zip_safe=False)
There is no need to change directory, run this one command to build rpms
python setup.py bdist_rpm
Here is the output, it is that easy:
-bash-4.1$ find . -name "*.spec"
./build/bdist.linux-x86_64/rpm/SPECS/color_print.spec
-bash-4.1$ find . -name "*.rpm"
./dist/color_print-0.1-1.noarch.rpm
./dist/color_print-0.1-1.src.rpm
In reality, you will definitely need to modify the spec files manually. and run
rpmbuild -ba ./build/bdist.linux-x86_64/rpm/SPECS/color_print.spec
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With