2012-11-23 63 views
3

這是我當前的項目設置:。而不是setup.py中指定的目錄?

. 
├── README.md 
├── build 
│   ├── bdist.macosx-10.8-intel 
│   └── lib 
├── dist 
│   └── giordano-0.1-py2.7.egg 
├── giordano.egg-info 
│   ├── PKG-INFO 
│   ├── SOURCES.txt 
│   ├── dependency_links.txt 
│   ├── not-zip-safe 
│   └── top_level.txt 
├── requirements.txt 
├── setup.py 
├── src 
│   ├── giordano 
│   └── spider 
├── test.txt 
└── venv 
    ├── bin 
    ├── include 
    ├── lib 
    └── share 

這是我的安裝文件:

from setuptools import setup 

setup(name='giordano', 
    version='0.1', 
    packages=['giordano'], 
    package_dir={'giordano': 'src/giordano'}, 
    zip_safe=False) 

當我做python setup.py install,我能夠在我的代碼import giordano沒有問題。

然而,當我做python setup.py develop,這是控制檯輸出:

[venv] fixSetup$ python setup.py develop 
running develop 
running egg_info 
writing giordano.egg-info/PKG-INFO 
writing top-level names to giordano.egg-info/top_level.txt 
writing dependency_links to giordano.egg-info/dependency_links.txt 
reading manifest file 'giordano.egg-info/SOURCES.txt' 
writing manifest file 'giordano.egg-info/SOURCES.txt' 
running build_ext 
Creating /Users/blah/Dropbox/projects/Giordano/venv/lib/python2.7/site-packages/giordano.egg-link (link to .) 
Removing giordano 0.1 from easy-install.pth file 
Adding giordano 0.1 to easy-install.pth file 

Installed /Users/blah/Dropbox/projects/Giordano 
Processing dependencies for giordano==0.1 
Finished processing dependencies for giordano==0.1 

我注意到,雞蛋鏈接到.,而不是src/giordano。我的代碼中不能再有import giordano了。

任何想法爲什麼發展不尊重package_dir

回答

0

嘗試'giordano':'src'。 distutils/distribute在您指定的目錄中查找模塊或軟件包名稱;在你粘貼的代碼中,該值是一個太深的目錄。

+0

我有'package_dir = {'giordano':'src'}'但我仍然無法導入giordano。 – disappearedng

+0

你能給出一個鏈接到代碼,或粘貼完整的回溯? –

+0

我看到這個工作在另一個項目中:package_dir = {'':'src'} –

相關問題