Packaging Telethon

  deb, packaging, python, telegram, telethon

I am using stdeb to package Telethon. I would (eventually) like to add it to Debian’s repositories. This is the error that I’m getting:

python3 setup.py --command-packages=stdeb.command bdist_deb
...
copying telethon/tl/types/updates.py -> Telethon-1.21.1/telethon/tl/types
copying telethon/tl/types/upload.py -> Telethon-1.21.1/telethon/tl/types
Writing Telethon-1.21.1/setup.cfg
Creating tar archive
removing 'Telethon-1.21.1' (and everything under it)
dpkg-buildpackage: info: source package telethon
dpkg-buildpackage: info: source version 1.21.1-1
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Lonami Exo <[email protected]>
 dpkg-source --before-build .
 debian/rules clean
dh clean --with python3 --buildsystem=pybuild
dh: warning: Compatibility levels before 10 are deprecated (level 9 in use)
   dh_auto_clean -O--buildsystem=pybuild
dh_auto_clean: warning: Compatibility levels before 10 are deprecated (level 9 in use)
I: pybuild base:232: python3.9 setup.py clean 
Traceback (most recent call last):
  File "/home/user0/Documents/temp/pac/Telethon-1.21.1/deb_dist/telethon-1.21.1/setup.py", line 244, in <module>
    main(sys.argv)
  File "/home/user0/Documents/temp/pac/Telethon-1.21.1/deb_dist/telethon-1.21.1/setup.py", line 155, in main
    generate(argv[2:], argv[1])
  File "/home/user0/Documents/temp/pac/Telethon-1.21.1/deb_dist/telethon-1.21.1/setup.py", line 66, in generate
    from telethon_generator.parsers import
ModuleNotFoundError: No module named 'telethon_generator'
E: pybuild pybuild:353: clean: plugin distutils failed with: exit code=1: python3.9 setup.py clean 
dh_auto_clean: error: pybuild --clean -i python{version} -p 3.9 returned exit code 13
make: *** [debian/rules:7: clean] Error 255
dpkg-buildpackage: error: debian/rules clean subprocess returned exit status 2
Traceback (most recent call last):
  File "/home/user0/Documents/temp/pac/Telethon-1.21.1/setup.py", line 244, in <module>
    main(sys.argv)
  File "/home/user0/Documents/temp/pac/Telethon-1.21.1/setup.py", line 194, in main
    setup(
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.9/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.9/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.9/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/stdeb/command/bdist_deb.py", line 34, in run
    self.run_command('sdist_dsc')
  File "/usr/lib/python3.9/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.9/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/stdeb/command/sdist_dsc.py", line 137, in run
    build_dsc(debinfo,
  File "/usr/lib/python3/dist-packages/stdeb/util.py", line 1522, in build_dsc
    dpkg_buildpackage(*args, cwd=fullpath_repackaged_dirname)
  File "/usr/lib/python3/dist-packages/stdeb/util.py", line 585, in dpkg_buildpackage
    process_command(args, cwd=cwd)
  File "/usr/lib/python3/dist-packages/stdeb/util.py", line 226, in process_command
    check_call(args, cwd=cwd)
  File "/usr/lib/python3/dist-packages/stdeb/util.py", line 59, in check_call
    raise CalledProcessError(retcode)
stdeb.util.CalledProcessError: 2

As you might notice, setup.py can’t import telethon_generator. Why is that and what can I do about it?
Here is Telethon’s tree (-L 2) for reference:

.
├── dev-requirements.txt
├── LICENSE
├── logo.svg
├── optional-requirements.txt
├── pyproject.toml
├── README.rst
├── readthedocs
│   ├── basic
│   ├── concepts
│   ├── conf.py
│   ├── custom_roles.py
│   ├── developing
│   ├── examples
│   ├── index.rst
│   ├── make.bat
│   ├── Makefile
│   ├── misc
│   ├── modules
│   ├── quick-references
│   └── requirements.txt
├── requirements.txt
├── setup.py
├── telethon
│   ├── client
│   ├── crypto
│   ├── entitycache.py
│   ├── errors
│   ├── events
│   ├── extensions
│   ├── helpers.py
│   ├── hints.py
│   ├── __init__.py
│   ├── network
│   ├── password.py
│   ├── requestiter.py
│   ├── sessions
│   ├── statecache.py
│   ├── sync.py
│   ├── tl
│   ├── utils.py
│   └── version.py
├── telethon_examples
│   ├── assistant.py
│   ├── gui.py
│   ├── interactive_telegram_client.py
│   ├── LICENSE
│   ├── payment.py
│   ├── print_messages.py
│   ├── print_updates.py
│   ├── quart_login.py
│   ├── README.md
│   ├── replier.py
│   └── screenshot-gui.jpg
├── telethon_generator
│   ├── data
│   ├── docswriter.py
│   ├── generators
│   ├── __init__.py
│   ├── parsers
│   ├── sourcebuilder.py
│   └── utils.py
├── tests
│   ├── __init__.py
│   ├── readthedocs
│   └── telethon
└── update-docs.sh

Any help towards solving the issue is appreciated…

Source: Python Questions

LEAVE A COMMENT