RuntimeError:原始源dist不能包含.pyc文件

时间:2017-07-25 08:46:12

标签: python sh

有一个Python文件pip2deb,它包含将配置文件中指定的PIP包编译成Debian包的逻辑。

有一个Shell脚本运行pip2deb

配置文件有多个条目:

Flask==0.12.2
requests==2.18.1
flasgger==0.6.5

所有这些都被编译得很好,除了flasgger会出错:

$ ./build.sh
Collecting flasgger==0.6.5
  Downloading flasgger-0.6.5.tar.gz (1.7MB)
  Saved /tmp/pip2deb_flasgger==0.6.5_9xtW9k/flasgger-0.6.5.tar.gz
Successfully downloaded flasgger
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
running the following command in directory: /tmp/pip2deb_flasgger==0.6.5_9xtW9k/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_9xtW9k/flasgger-0.6.5 --use-premade-distfile=/tmp/pip2deb_flasgger==0.6.5_9xtW9k/flasgger-0.6.5.tar.gz 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'
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_9xtW9k/flasgger-0.6.5 --use-premade-distfile=/tmp/pip2deb_flasgger==0.6.5_9xtW9k/flasgger-0.6.5.tar.gz bdist_deb
ERROR in /tmp/pip2deb_flasgger==0.6.5_9xtW9k/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_9xtW9k/flasgger-0.6.5', '/tmp/pip2deb_flasgger==0.6.5_9xtW9k/flasgger-0.6.5.tar.gz']' returned non-zero exit status 1

导致pyp2deb错误的行是:

subprocess.check_call(cmd, env=env)

有什么建议吗?

编辑:我发现这个问题仅存在于Flasgger 0.6.0+版本中。以下所有内容都被编译好了。好奇,版本会如何影响?

0 个答案:

没有答案