2017-10-24 4 views
0

sdist/wheel으로 생성 된 패키지를 생성하여 파일에 포함시키는 방법을 찾고 있습니다.sdist 용 파일 생성

빌드 중에 픽업 될 새 파일을 만드는 프로세스에 연결하는 방법이 있습니까?

답변

1

build 단계를 덮어 쓰는 동안 파일을 빌드하려면 cmdclass. https://stackoverflow.com/a/43728788/7976758 참조 :

import distutils.command.build 

# Override build command 
class BuildCommand(distutils.command.build.build): 

    def run(self): 
     # Run the original build command 
     distutils.command.build.build.run(self) 
     # Custom build stuff goes here 

# Replace the build command with ours 
setup(..., 
     cmdclass={"build": BuildCommand}) 

MANIFEST 또는 MANIFEST.in에서의 sdist 목록에서 비 코드 파일을 포함하려면. https://docs.python.org/3/distutils/sourcedist.html#specifying-the-files-to-distribute

wheel에 코드가 아닌 파일을 포함 시키려면 setup.pypackage_data을 입력하십시오. https://docs.python.org/3/distutils/setupscript.html#installing-package-data 참조 :

setup(..., 
     packages=['mypkg'], 
     package_data={'mypkg': ['*.dat']}, 
    )