내 setup.py가 Python 패키지 (예 : init.d 스크립트 설치, 디렉토리 및 파일 작성 등)를 설치하는 것 외에도 일부 사용자 정의 작업을 수행하기를 원합니다. distutils/setuptools 클래스를 사용자 정의하여 사용자 정의 할 수 있음을 알고 있습니다. 행위. 내가 겪고있는 문제는 패키지 디렉토리로 가서 "python setup.py install"을 할 때 모든 것이 작동하지만 "easy_install mypackage.tar.gz"를 실행하면 사용자 정의 클래스가 실행되지 않는 것 같습니다. 여기 내 setup.py 파일 (테스트하기 위해 같은 디렉토리에 빈 myfoobar.py 파일을 만듭니다)입니다 :easy_install을 setup.py에서 커스텀 커맨드를 실행시키는 방법?
import setuptools
from setuptools.command import install as _install
class install(_install.install):
def initialize_options(self):
_install.install.initialize_options(self)
def finalize_options(self):
_install.install.finalize_options(self)
def run(self):
# Why is this never executed when tarball installed with easy_install?
# It does work with: python setup.py install
import pdb;pdb.set_trace()
_install.install.run(self)
setuptools.setup(
name = 'myfoobar',
version = '0.1',
platforms = ['any'],
description = 'Test package',
author = 'Someone',
py_modules = ['myfoobar'],
cmdclass = {'install': install},
)
같은 일이 내가 "설정"과의 distutils에서 "설치"를 가져올 경우에도 발생합니다. easy_install이 내 사용자 정의 클래스를 실행할 수있는 방법에 대한 아이디어가 있습니까?
분명히하기 위해 Buildout이나 Paver와 같은 추가 기능은 사용하고 싶지 않습니다.
내가 원했던 대답은 아니지만 주어진 수있는 최선을 추측합니다. 그래서 나는 대답으로 그것을 수여하고있다. 감사! –