Каков хороший способ преобразовать приложение python в пакет Debian

#python #python-3.x #django #linux

Вопрос:

цель: преобразовать мое приложение python в пакет debian

То, что я попробовал, описано ниже.

структура проекта ниже

 demo_project(root directory)
  |-myscript (package)
      - clock.py
      - __init__.py
   -setup.py
   - demp_project_env  
 

clock.py

 from tkinter import *
from tkinter.ttk import *

# importing strftime function to
# retrieve system's time
from time import strftime

# creating tkinter window
def main():
    window=Tk()
    # add widgets here
    window.title('Hello Python')
    window.geometry("300x200 10 20")
    window.mainloop()

if __name__=='__main__':
    main()
 

setup.py

 import os
from setuptools import setup
setup(
    name = "myscript",
    version = "1.0",
    author = "Nishad",
    author_email = "nishad@gmail.com",
    description = "Demo of packaging a Python script as DEB",
    license = "BSD",
    url = "url",
    packages=['myscript'],
    entry_points = {
        'console_scripts' : ['myscript = myscript.clock:main']
    },
    classifiers=[
        "License :: OSI Approved :: BSD License",
    ],
)
 

Список зависимостей

 (venv) nishad:~/demo_project$ pip freeze
future==0.18.2
Jinja2==3.0.1
make-deb==0.0.5
MarkupSafe==2.0.1
PyQt5==5.15.4
PyQt5-Qt5==5.15.2
PyQt5-sip==12.9.0
stdeb==0.10.0
tk==0.1.0
 

Я попытался преобразовать python в пакет deb с помощью stdeb в python

Документация stdeb https://pypi.org/project/stdeb/

Я выполнил приведенный ниже код python3 setup.py --command-packages=stdeb.command bdist_deb

 running bdist_deb
running sdist_dsc
running egg_info
creating myscript.egg-info
writing myscript.egg-info/PKG-INFO
writing dependency_links to myscript.egg-info/dependency_links.txt
writing entry points to myscript.egg-info/entry_points.txt
writing top-level names to myscript.egg-info/top_level.txt
writing manifest file 'myscript.egg-info/SOURCES.txt'
reading manifest file 'myscript.egg-info/SOURCES.txt'
writing manifest file 'myscript.egg-info/SOURCES.txt'
running sdist
warning: sdist: standard file not found: should have one of README, README.rst, README.txt, README.md

running check
creating myscript-1.0
creating myscript-1.0/myscript
creating myscript-1.0/myscript.egg-info
copying files to myscript-1.0...
copying setup.py -> myscript-1.0
copying myscript/__init__.py -> myscript-1.0/myscript
copying myscript/clock.py -> myscript-1.0/myscript
copying myscript.egg-info/PKG-INFO -> myscript-1.0/myscript.egg-info
copying myscript.egg-info/SOURCES.txt -> myscript-1.0/myscript.egg-info
copying myscript.egg-info/dependency_links.txt -> myscript-1.0/myscript.egg-info
copying myscript.egg-info/entry_points.txt -> myscript-1.0/myscript.egg-info
copying myscript.egg-info/top_level.txt -> myscript-1.0/myscript.egg-info
Writing myscript-1.0/setup.cfg
creating dist
Creating tar archive
removing 'myscript-1.0' (and everything under it)
dpkg-buildpackage: info: source package myscript
dpkg-buildpackage: info: source version 1.0-1
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Nishad <nishad@gmail.com>
 dpkg-source --before-build .
dpkg-source: info: using options from myscript-1.0/debian/source/options: --extend-diff-ignore=.egg-info$
 fakeroot debian/rules clean
dh clean --with python3 --buildsystem=python_distutils
dh: error: unable to load addon python3: Can't locate Debian/Debhelper/Sequence/python3.pm in @INC (you may need to install the Debian::Debhelper::Sequence::python3 module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at (eval 11) line 1.
BEGIN failed--compilation aborted at (eval 11) line 1.

make: *** [debian/rules:7: clean] Error 255
dpkg-buildpackage: error: fakeroot debian/rules clean subprocess returned exit status 2
Traceback (most recent call last):
  File "setup.py", line 3, in <module>
    setup(
  File "/home/arc/demo_project/venv/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/arc/demo_project/venv/lib/python3.8/site-packages/stdeb/command/bdist_deb.py", line 34, in run
    self.run_command('sdist_dsc')
  File "/usr/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/arc/demo_project/venv/lib/python3.8/site-packages/stdeb/command/sdist_dsc.py", line 137, in run
    build_dsc(debinfo,
  File "/home/arc/demo_project/venv/lib/python3.8/site-packages/stdeb/util.py", line 1569, in build_dsc
    dpkg_buildpackage(*args, cwd=fullpath_repackaged_dirname)
  File "/home/arc/demo_project/venv/lib/python3.8/site-packages/stdeb/util.py", line 585, in dpkg_buildpackage
    process_command(args, cwd=cwd)
  File "/home/arc/demo_project/venv/lib/python3.8/site-packages/stdeb/util.py", line 226, in process_command
    check_call(args, cwd=cwd)
  File "/home/arc/demo_project/venv/lib/python3.8/site-packages/stdeb/util.py", line 59, in check_call
    raise CalledProcessError(retcode)
stdeb.util.CalledProcessError: 2

 

Пожалуйста, объясните мне, в чем ошибка этого метода.

Комментарии:

1. Смотрите также Конструктор панели запуска — Не удается найти Debian/Debhelper/Последовательность/python3.pm