简体   繁体   English

python setup.py安装多个模块

[英]python setup.py to install multiple modules

Below is my setup.py code : 以下是我的setup.py代码:

from os import path
import sys
python_version = sys.version_info[:2]

if python_version < (2, 6):
    raise Exception("This version of xlrd requires Python 2.6 or above. "
                "For older versions of Python, you can use the 0.8 series.")

av = sys.argv
if len(av) > 1 and av[1].lower() == "--egg":
    del av[1]
    from setuptools import setup
else:
    from distutils.core import setup

from xlrd.xlrd.info import __VERSION__ as p
from xlwt.xlwt import __VERSION__

DESCRIPTION = (
    'Library to create spreadsheet files compatible with '
     'MS Excel 97/2000/XP/2003 XLS files, '
     'on any platform, with Python 2.3 to 2.7'
     )



CLASSIFIERS = [
    'Operating System :: OS Independent',
    'Programming Language :: Python',
    'License :: OSI Approved :: BSD License',
    'Development Status :: 5 - Production/Stable',
    'Intended Audience :: Developers',
    'Topic :: Software Development :: Libraries :: Python Modules',
    'Topic :: Office/Business :: Financial :: Spreadsheet',
    'Topic :: Database',
    'Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries',
    ]

KEYWORDS = (
    'xls excel spreadsheet workbook worksheet pyExcelerator'
    )
setup(
    name = 'xlrd',
    version = p,
    author = 'John Machin',
    author_email = 'sjmachin@lexicon.net',
    url = 'http://www.python-excel.org/',
    packages = ['xlrd'],
    scripts = [
        'xlrd/scripts/runxlrd.py',
         ],
    package_data={
        'xlrd/xlrd': [
            'doc/*.htm*',
            # 'doc/*.txt',
            'examples/*.*',
            ],

        },

keywords = ['xls', 'excel', 'spreadsheet', 'workbook'],
classifiers = [
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 3',
        'Operating System :: OS Independent',
        'Topic :: Database',
        'Topic :: Office/Business',
        'Topic :: Software Development :: Libraries :: Python Modules',
        ],

)
setup (
    name = 'xlwt',
    version = __VERSION__,
    maintainer = 'John Machin',
    maintainer_email = 'sjmachin@lexicon.net',
    url = 'http://www.python-excel.org/',
    download_url = 'http://pypi.python.org/pypi/xlwt',
    description = DESCRIPTION,
    long_description = LONG_DESCRIPTION,
    license = 'BSD',
    platforms = 'Platform Independent',
    packages = ['xlwt'],
    keywords = KEYWORDS,
    classifiers = CLASSIFIERS,
    package_data = {
        'xlwt/xlwt': [
            'doc/*.*',
            'examples/*.*',
            'tests/*.*',
            ],
        },
       )

I have tried to marge setup.py of both xlrd and xlwt here and trying to run master setup.py to install both the modules at one shot. 我试图在此处xlrdxlwt setup.py ,并尝试运行master setup.py安装两个模块。 It is installing the modules but not the attributes so can't use those modules. 它正在安装模块,但没有安装属性,因此不能使用这些模块。 Basically my need is to run a single script and install multiple modules in clients machine. 基本上,我需要运行一个脚本并在客户端计算机中安装多个模块。 Is is possible? 有可能吗? Please guide me if ay other way I can do this . 如果可以的话,请指导我。 Thanks in advance. 提前致谢。

As an example of invoking setup.py of both packages. 作为调用两个软件包的setup.py的示例。 Let's consider that you are in a some top level directory with the following structure: 让我们考虑一下您位于某个具有以下结构的顶级目录中:

mydir
|
|--setup.sh # global setup script
|
|--xlrd
|  |
|  |--...
|  |--setup.py
|  |--...
|
|--xlwt
   |
   |--...
   |--setup.py
   |--...

A shell script is simple: 一个shell脚本很简单:

#!/bin/sh
python ./xlrd/setup.py install
python ./xlwt/setup.py install

A batch script should be pretty similar: 批处理脚本应该非常相似:

xlrd\setup.py install
xlwt\setup.py install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM