Foad Tahmasebi
Foad Tahmasebi

Reputation: 1352

create .deb package by python setup.py

i want create .deb package for my python program. i create setup.py and it works well, but when I want to create a debian package using setup.py and stdeb I get an error.

the commands I use to create .deb:

first:

python3.4 setup.py sdist

then:

python3.4 setup.py --command-packages=stdeb.command bdist_deb

but get error

dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied;  aborting
dpkg-buildpackage: warning: (Use -d flag to override.)

Traceback (most recent call last):
File "setup.py", line 19, in <module>
install_requires=['setproctitle', 'psycopg2', 'psutil']
File "/usr/lib/python3.4/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.4/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.4/dist-packages/stdeb/command/bdist_deb.py", line 48, in run
util.process_command(syscmd,cwd=target_dirs[0])
File "/usr/local/lib/python3.4/dist-packages/stdeb/util.py", line 183, in process_command
check_call(args, cwd=cwd)
File "/usr/local/lib/python3.4/dist-packages/stdeb/util.py", line 46, in check_call
raise CalledProcessError(retcode)
stdeb.util.CalledProcessError: 3

I use these options in setup.py:

packages=['myapp', 'myapp.models', 'myapp.classes', 'myapp.functions'],
package_data={'': ['myapp.conf']},
data_files=[('/usr/local/bin/', ['myapp/myapp_run.py']),
            ('/usr/local/etc/myapp', ['myapp/myapp.conf'])],
install_requires=['setproctitle', 'psycopg2', 'psutil']

and my project directory is like:

|  setup.py
|- myapp 
        |  __init__.py
        |- classes
                  | __init.py
                  | ...
        | ...
        | myapp_run.py
        | myapp.conf

Upvotes: 8

Views: 11188

Answers (2)

Anil Kumar
Anil Kumar

Reputation: 102

first try running this: apt-get install python3-stdeb fakeroot python-all

followed by:

python3.4 setup.py sdist

reference link: Use stdeb to make Debian packages for a Python package

Upvotes: 5

Urban48
Urban48

Reputation: 1476

check out debpackager, its a cli tool for creating deb packages out of any project, including python projects.

Upvotes: 0

Related Questions