安装Python包时自定义构建选项,从远程仓库安装Python包
创始人
2024-11-09 11:00:24
0

可以使用setuptools以编程方式打包和分发Python包,并创建安装程序或客户端安装脚本。以下是一个示例,显示如何在安装程序或客户端安装脚本中指定自定义构建选项以从远程仓库安装Python包:

from setuptools import setup, Command
from distutils.command.build import build

class MyBuildCommand(build):
    def run(self):
        # Your custom build commands here:
        self.run_command('build_ext')
        build.run(self)

class InstallCommand(Command):
    user_options = []

    def initialize_options(self):
        # Your custom initialization options here:
        pass

    def finalize_options(self):
        # Your custom finalization options here:
        pass

    def run(self):
        # Your custom install commands here:
        self.run_command('build')
        self.run_command('bdist_wheel')
        self.run_command('bdist_wininst')
        self.run_command('bdist_msi')

setup(
    # Your package information here:
    name='my_package',
    version='1.0.0',
    description='My awesome package',
    url='https://github.com/my_package',
    author='Me',
    author_email='me@my_package.com',
    license='MIT',
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Programming Language :: Python',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Programming Language :: Python :: 3.7',
    ],
    keywords='example documentation tutorial',
    packages=['my_package'],
    install_requires=['requests', 'numpy'],
    # Your custom build options here:
    cmdclass={
        'build': MyBuildCommand,
        'install': InstallCommand
    }
)

在此示例中,“MyBuildCommand”和“InstallCommand”是自定义命令类。您可以使用任何名称来指定这些类,并在“cmdclass”字典

相关内容

热门资讯

据了解!德州局脚本,yy比鸡脚... 据了解!德州局脚本,yy比鸡脚本,烘培辅助器(有挂技巧)-哔哩哔哩1、玩家可以在德州局脚本透视最简单...
突发!杭州都莱大菠萝有挂吗(辅... 突发!杭州都莱大菠萝有挂吗(辅助)竟然有挂辅助软件(有挂透明挂)-哔哩哔哩1、杭州都莱大菠萝有挂吗辅...
此事引发广泛关注!aa pok... 此事引发广泛关注!aa poker辅助包,创思维激k透视视频,手册辅助工具(有挂攻略)-哔哩哔哩创思...
受玩家影响!川南久久辅助(辅助... 受玩家影响!川南久久辅助(辅助)都是真的有辅助软件(有挂教程)-哔哩哔哩一、川南久久辅助可以开透视的...
透视攻略!epoker透视底牌... 透视攻略!epoker透视底牌,顺兴茶楼开挂,指南书辅助工具(有挂分析)-哔哩哔哩epoker透视底...
据公告内容!财神13游戏辅助器... 据公告内容!财神13游戏辅助器脚本(辅助)好像是真的辅助安装(有挂秘诀)-哔哩哔哩财神13游戏辅助器...
据文件显示!epoker透视底... 据文件显示!epoker透视底牌,红茶馆app辅助,妙招辅助方法(了解有挂)-哔哩哔哩该软件可以轻松...
刚刚!潮汕鱼虾蟹辅助器(辅助)... 刚刚!潮汕鱼虾蟹辅助器(辅助)确实真的有辅助平台(有挂方针)-哔哩哔哩运潮汕鱼虾蟹辅助器辅助工具,进...
2026版方法!智星菠萝可以辅... 2026版方法!智星菠萝可以辅助吗,wepoker辅助器,手筋辅助技巧(有挂技巧)-哔哩哔哩1、每一...
无独有偶!微乐小程序辅助开发透... 无独有偶!微乐小程序辅助开发透视(辅助)切实真的有辅助下载(有挂详情)-哔哩哔哩所有人都在同一条线上...