Python distutils error: “[directory]… doesn't exist or not a regular file”

后端 未结 4 1107
耶瑟儿~
耶瑟儿~ 2021-02-05 03:54

Let\'s take the following project layout:

$ ls -R .
.:
package  setup.py

./package:
__init__.py  dir  file.dat  module.py

./package/dir:
tool1.dat  tool2.dat
<         


        
4条回答
  •  天涯浪人
    2021-02-05 04:23

    You could use Distribute instead of distutils. It works basically the same (for the most part, you will not have to change your setup.py) and it gives you the exclude_package_data option:

    from distribute_setup import use_setuptools
    use_setuptools()
    
    from setuptools import setup
    
    setup(name='pyproj',
          version='0.1',
    
          packages=[
              'package',
          ],
          package_data={
              'package': [
                  '*.dat',
                  'dir/*'
              ],
          },
          exclude_package_data={
              'package': [
                  'dir'
              ],
          },
         )
    

提交回复
热议问题