異なるアーキテクチャで異なる動作をする Python パッケージ用のセットアップ スクリプトを作成したいと考えています。
私は次のことから始めました:
class CustomInstallCommand(install):
def run(self):
if 'win32' in sys.platform:
if not os.path.exists('./.setup'):
os.mkdir('./.setup')
urllib.urlretrieve(("http://www.voidspace.org.uk/downloads/"
"pycrypto26/pycrypto-2.6.win32-py2.7.exe"),
os.path.join('./.setup',
('pycrypto-2.6.win32-py2.7.exe')))
os.system('easy_install '
+ os.path.join('./.setup',
'pycrypto-2.6.win32-py2.7.exe'))
### here should come more windows specific instructions
### how do I get my setup script to download all the dependecies given below???
install.run(self)
else:
install.run(self)
setup(... trimmed ...
zip_safe=False,
install_requires=['pycrypto>=2.6',
'colorama>=0.2.4',
'dependency1>=0.1,
'dependency2>=0.0.1],
classifiers=[
'Environment :: Console',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7'
],
cmdclass={'install': CustomInstallCommand},
)
を使用してアーキテクチャを検出できますが、セットアップ オプションを認識さsys.platfrom
せるにはどうすればよいですか?CustomInstallCommand
アップデート:
でメソッドself.distribution.install_requires
の内部を調べたときに、これを見つけました。次に、依存関係をインストールする方法を理解する必要があります。呼び出すだけでは colorama とその他の依存関係がインストールされないように思われるためです。run
self
install.run(self)