question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RuntimeError: original source dist cannot contain .pyc files

See original GitHub issue

Trying to convert PIP packages into Debian packages using python-stdeb (for maintainability purposes). Having scripts and mechanism to do it, which works perfectly fine. It converts any PIP package into debian except for flasgger version 0.6.0+ (so 0.5.14 and every version below getting converted just fine):

$ ./build.sh
Collecting flasgger==0.6.5
  Downloading flasgger-0.6.5.tar.gz (1.7MB)
  Saved /tmp/pip2deb_flasgger==0.6.5_mJFDnt/flasgger-0.6.5.tar.gz
Successfully downloaded flasgger
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
running the following command in directory: /tmp/pip2deb_flasgger==0.6.5_mJFDnt/flasgger-0.6.5/tmp_py2dsc/flasgger-0.6.5
/usr/bin/python setup.py --command-packages stdeb.command sdist_dsc --dist-dir=/tmp/pip2deb_flasgger==0.6.5_mJFDnt/flasgger-0.6.5 --use-premade-distfile=/tmp/pip2deb_flasgger==0.6.5_mJFDnt/flasgger-0.6.5.tar.gz --extra-cfg-file=/shared/pip2deb.conf bdist_deb
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
running sdist_dsc
running egg_info
writing requirements to flasgger.egg-info/requires.txt
writing flasgger.egg-info/PKG-INFO
writing top-level names to flasgger.egg-info/top_level.txt
writing dependency_links to flasgger.egg-info/dependency_links.txt
reading manifest file 'flasgger.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*' under directory 'flasgger/ui3/static/css'
warning: no files found matching '*' under directory 'flasgger/ui3/static/fonts'
warning: no files found matching '*' under directory 'flasgger/ui3/static/images'
warning: no files found matching '*' under directory 'flasgger/ui3/static/lang'
warning: no files found matching '*' under directory 'flasgger/ui3/static/lib'
writing manifest file 'flasgger.egg-info/SOURCES.txt'
configuration files were specified, but no options were found in "flasgger" or "DEFAULT" sections.
Traceback (most recent call last):
  File "setup.py", line 52, in <module>
    'six>=1.10.0'
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python2.7/dist-packages/stdeb/command/sdist_dsc.py", line 123, in run
    raise RuntimeError('original source dist cannot '
RuntimeError: original source dist cannot contain .pyc files
ERROR running: /usr/bin/python setup.py --command-packages stdeb.command sdist_dsc --dist-dir=/tmp/pip2deb_flasgger==0.6.5_mJFDnt/flasgger-0.6.5 --use-premade-distfile=/tmp/pip2deb_flasgger==0.6.5_mJFDnt/flasgger-0.6.5.tar.gz --extra-cfg-file=/shared/pip2deb.conf bdist_deb
ERROR in /tmp/pip2deb_flasgger==0.6.5_mJFDnt/flasgger-0.6.5/tmp_py2dsc/flasgger-0.6.5
Traceback (most recent call last):
  File "pip2deb.py", line 129, in <module>
    main()
  File "pip2deb.py", line 124, in main
    extra_cfg_file=args.extra_cfg_file,
  File "pip2deb.py", line 84, in download_and_build
    extra_cfg_file=extra_cfg_file,
  File "pip2deb.py", line 66, in build
    subprocess.check_call(cmd, env=env)
  File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['py2dsc-deb', '--dist-dir', '/tmp/pip2deb_flasgger==0.6.5_mJFDnt/flasgger-0.6.5', '--extra-cfg-file', 'pip2deb.conf', '/tmp/pip2deb_flasgger==0.6.5_mJFDnt/flasgger-0.6.5.tar.gz']' returned non-zero exit status 1

Again this happens only of Flasgger version >= 0.6.0.

Was something changed severely between 0.5.14 and 0.6.0 that could cause the problem with PYC files?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
JoakimSoderbergcommented, Aug 21, 2017

https://docs.python.org/2/distutils/sourcedist.html#commands

Maybe this can be used in the MANIFEST file:

global-exclude pat1 pat2 … exclude all files anywhere in the source tree matching — & any of the listed patterns

something like (if I understand it correctly):

global-exclude __pycache__
Read more comments on GitHub >

github_iconTop Results From Across the Web

RuntimeError: original source dist cannot contain .pyc files
There is a Python file pip2deb which contains logic to compile PIP packages specified in config file into Debian packages.
Read more >
Python build_dsc Examples
raise RuntimeError('Patches cannot be applied in debianize command') dist_dir ... raise RuntimeError('original source dist cannot ' 'contain .pyc files') ...
Read more >
setuptools 8.0.2 - PyPI
Easily download, build, install, upgrade, and uninstall Python packages.
Read more >
Python Code Parsing and pyc Files - Oracle Help Center
When a Python source file (module) is imported during an execution for the first time, the appropriate .pyc file is created automatically. If...
Read more >
Advanced Topics — PyInstaller 5.7.0 documentation
A Python error trace will point to the source file from which the archive entry was created (the __file__ attribute from the time...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found