当前位置: 首页>>代码示例>>Python>>正文


Python setup.py方法代码示例

本文整理汇总了Python中distutils.core.setup.py方法的典型用法代码示例。如果您正苦于以下问题:Python setup.py方法的具体用法?Python setup.py怎么用?Python setup.py使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在distutils.core.setup的用法示例。


在下文中一共展示了setup.py方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from distutils.core import setup [as 别名]
# 或者: from distutils.core.setup import py [as 别名]
def run(self):
        result = install_lib.run(self)
        fullfname = os.path.join(self.install_dir, 'ivre', '__init__.py')
        tmpfname = "%s.tmp" % fullfname
        stat = os.stat(fullfname)
        os.rename(fullfname, tmpfname)
        with open(fullfname, 'w') as newf:
            with open(tmpfname) as oldf:
                for line in oldf:
                    if line.startswith('import '):
                        newf.write('VERSION = %r\n' % VERSION)
                        break
                    newf.write(line)
        os.chown(fullfname, stat.st_uid, stat.st_gid)
        os.chmod(fullfname, stat.st_mode)
        os.unlink(tmpfname)
        return result 
开发者ID:cea-sec,项目名称:ivre,代码行数:19,代码来源:setup.py

示例2: test_debug_mode

# 需要导入模块: from distutils.core import setup [as 别名]
# 或者: from distutils.core.setup import py [as 别名]
def test_debug_mode(self):
        # this covers the code called when DEBUG is set
        sys.argv = ['setup.py', '--name']
        with captured_stdout() as stdout:
            distutils.core.setup(name='bar')
        stdout.seek(0)
        self.assertEqual(stdout.read(), 'bar\n')

        distutils.core.DEBUG = True
        try:
            with captured_stdout() as stdout:
                distutils.core.setup(name='bar')
        finally:
            distutils.core.DEBUG = False
        stdout.seek(0)
        wanted = "options (after parsing config files):\n"
        self.assertEqual(stdout.readlines()[0], wanted) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:19,代码来源:test_core.py

示例3: get_cmd

# 需要导入模块: from distutils.core import setup [as 别名]
# 或者: from distutils.core.setup import py [as 别名]
def get_cmd(self, metadata=None):
        """Returns a cmd"""
        if metadata is None:
            metadata = {'name': 'fake', 'version': '1.0',
                        'url': 'xxx', 'author': 'xxx',
                        'author_email': 'xxx'}
        dist = Distribution(metadata)
        dist.script_name = 'setup.py'
        dist.packages = ['somecode']
        dist.include_package_data = True
        cmd = sdist(dist)
        cmd.dist_dir = 'dist'
        def _warn(*args):
            pass
        cmd.warn = _warn
        return dist, cmd 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:18,代码来源:test_sdist.py

示例4: test_run_setup_uses_current_dir

# 需要导入模块: from distutils.core import setup [as 别名]
# 或者: from distutils.core.setup import py [as 别名]
def test_run_setup_uses_current_dir(self):
        # This tests that the setup script is run with the current directory
        # as its own current directory; this was temporarily broken by a
        # previous patch when TESTFN did not use the current directory.
        sys.stdout = StringIO.StringIO()
        cwd = os.getcwd()

        # Create a directory and write the setup.py file there:
        os.mkdir(test.test_support.TESTFN)
        setup_py = os.path.join(test.test_support.TESTFN, "setup.py")
        distutils.core.run_setup(
            self.write_setup(setup_prints_cwd, path=setup_py))

        output = sys.stdout.getvalue()
        if output.endswith("\n"):
            output = output[:-1]
        self.assertEqual(cwd, output) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:19,代码来源:test_core.py

示例5: get_lib_path

# 需要导入模块: from distutils.core import setup [as 别名]
# 或者: from distutils.core.setup import py [as 别名]
def get_lib_path():
    """Get library path, name and version"""
    # We can not import `libinfo.py` in setup.py directly since __init__.py
    # Will be invoked which introduces dependences
    libinfo_py = os.path.join(CURRENT_DIR, './tvm/_ffi/libinfo.py')
    libinfo = {'__file__': libinfo_py}
    exec(compile(open(libinfo_py, "rb").read(), libinfo_py, 'exec'), libinfo, libinfo)
    version = libinfo['__version__']
    if not os.getenv('CONDA_BUILD'):
        lib_path = libinfo['find_lib_path']()
        libs = [lib_path[0]]
        if libs[0].find("runtime") == -1:
            for name in lib_path[1:]:
                if name.find("runtime") != -1:
                    libs.append(name)
                    break
    else:
        libs = None
    return libs, version 
开发者ID:mlperf,项目名称:training_results_v0.6,代码行数:21,代码来源:setup.py

示例6: get_lib_path

# 需要导入模块: from distutils.core import setup [as 别名]
# 或者: from distutils.core.setup import py [as 别名]
def get_lib_path():
    """Get library path, name and version"""
    # We can not import `libinfo.py` in setup.py directly since __init__.py
    # Will be invoked which introduces dependences
    CURRENT_DIR = os.path.dirname(__file__)
    libinfo_py = os.path.join(CURRENT_DIR, '../../python/tvm/_ffi/libinfo.py')
    libinfo = {'__file__': libinfo_py}
    exec(compile(open(libinfo_py, "rb").read(), libinfo_py, 'exec'), libinfo, libinfo)
    version = libinfo['__version__']
    if not os.getenv('CONDA_BUILD'):
        lib_path = libinfo['find_lib_path'](get_lib_names())
        libs = [lib_path[0]]
        if libs[0].find("runtime") == -1:
            for name in lib_path[1:]:
                if name.find("runtime") != -1:
                    libs.append(name)
                    break
    else:
        libs = None
    return libs, version 
开发者ID:mlperf,项目名称:training_results_v0.6,代码行数:22,代码来源:setup.py

示例7: test_run_setup_uses_current_dir

# 需要导入模块: from distutils.core import setup [as 别名]
# 或者: from distutils.core.setup import py [as 别名]
def test_run_setup_uses_current_dir(self):
        # This tests that the setup script is run with the current directory
        # as its own current directory; this was temporarily broken by a
        # previous patch when TESTFN did not use the current directory.
        sys.stdout = io.StringIO()
        cwd = os.getcwd()

        # Create a directory and write the setup.py file there:
        os.mkdir(test.support.TESTFN)
        setup_py = os.path.join(test.support.TESTFN, "setup.py")
        distutils.core.run_setup(
            self.write_setup(setup_prints_cwd, path=setup_py))

        output = sys.stdout.getvalue()
        if output.endswith("\n"):
            output = output[:-1]
        self.assertEqual(cwd, output) 
开发者ID:CedricGuillemet,项目名称:Imogen,代码行数:19,代码来源:test_core.py

示例8: get_package_data_files

# 需要导入模块: from distutils.core import setup [as 别名]
# 或者: from distutils.core.setup import py [as 别名]
def get_package_data_files(directory, exclude=[]):
    """
    Find data files recursibely.
    Original version from: https://stackoverflow.com/questions/27664504/how-to-add-package-data-recursively-in-python-setup-py
    :param directory: directory to search recursively
    :type directory: str
    :param exclude: list of absolute paths to ignore
    :type exclude: list of str
    :return: package data files to include
    :rtype: list of str
    """
    paths = []
    for (path, directories, filenames) in os.walk(directory):
        for filename in filenames:
            fp = os.path.abspath(os.path.join('..', path, filename))
            skip = False
            for v in exclude:
                if fp.startswith(v):
                    skip = True
            if not skip:
                paths.append(fp)
    return paths 
开发者ID:ywangd,项目名称:stash,代码行数:24,代码来源:setup.py

示例9: get_stash_version

# 需要导入模块: from distutils.core import setup [as 别名]
# 或者: from distutils.core.setup import py [as 别名]
def get_stash_version(corepath):
    """
    Find and return the current StaSh version.
    :param corepath: path to the 'core.py' file in the StaSh root directory
    :type corepath: str
    :return: the StaSh version defined in the corepath
    :rtype: str
    """
    with open(corepath, "r") as fin:
        for line in fin:
             if line.startswith("__version__"):
                 version = ast.literal_eval(line.split("=")[1].strip())
                 return version
    raise Exception("Could not find StaSh version in file '{f}'", f=corepath)


# before we start with the setup, we must be outside of the stash root path. 
开发者ID:ywangd,项目名称:stash,代码行数:19,代码来源:setup.py

示例10: main

# 需要导入模块: from distutils.core import setup [as 别名]
# 或者: from distutils.core.setup import py [as 别名]
def main () :
    
    if platform.architecture()[0] == "32bit":
        helper = 'helper32'
    else :
        helper = 'helper64'
        
    py2exe_options = dict(
        packages = [],
        optimize=2,
        compressed=True, # uncompressed may or may not have a faster startup
        bundle_files=3,
        dist_dir=helper,
        )
    
    setup(console=['eml2pst.py'],
          name = "EML2PST",
          version = "0.1",
          description = "A simple EML to PST conversion utility",
          options={"py2exe": py2exe_options},
        ) 
开发者ID:adb014,项目名称:nsf2x,代码行数:23,代码来源:create_helper.py

示例11: discover_and_run_tests

# 需要导入模块: from distutils.core import setup [as 别名]
# 或者: from distutils.core.setup import py [as 别名]
def discover_and_run_tests():
    import os
    import sys
    import unittest

    # get setup.py directory
    setup_file = sys.modules['__main__'].__file__
    setup_dir = os.path.abspath(os.path.dirname(setup_file))

    # use the default shared TestLoader instance
    test_loader = unittest.defaultTestLoader

    # use the basic test runner that outputs to sys.stderr
    test_runner = unittest.TextTestRunner()

    # automatically discover all tests
    # NOTE: only works for python 2.7 and later
    test_suite = test_loader.discover(setup_dir)

    # run the test suite
    result = test_runner.run(test_suite)
    if len(result.failures) + len(result.errors) > 0:
        exit(1) 
开发者ID:MartijnBraam,项目名称:python-isc-dhcp-leases,代码行数:25,代码来源:setup.py

示例12: create_files

# 需要导入模块: from distutils.core import setup [as 别名]
# 或者: from distutils.core.setup import py [as 别名]
def create_files(self):
        decor = '~' * len(self.shortname)
        with open(os.path.join(self.output_folder, self.shortname,
                               '__init__.py'), 'w') as f:
            f.write(FILE_HEADER_TEMPLATE % dict(
                module=self.shortname,
                moduledecor=decor,
                year=datetime.utcnow().year,
                name=self.author,
            ))
        with open(os.path.join(self.output_folder, 'setup.py'), 'w') as f:
            f.write(SETUP_PY_TEMPLATE % dict(
                name=self.name,
                namedecor='~' * len(self.name),
                urlname=quote(self.name),
                author=self.author,
                extname=self.shortname,
                email=self.email,
            )) 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:21,代码来源:make-kivyext.py

示例13: get_version

# 需要导入模块: from distutils.core import setup [as 别名]
# 或者: from distutils.core.setup import py [as 别名]
def get_version(*file_paths):
    """Retrieves the version from django_json_widget/__init__.py"""
    filename = os.path.join(os.path.dirname(__file__), *file_paths)
    version_file = open(filename).read()
    version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
                              version_file, re.M)
    if version_match:
        return version_match.group(1)
    raise RuntimeError('Unable to find version string.')


# version = get_version("django_json_widget", "__init__.py") 
开发者ID:jmrivas86,项目名称:django-json-widget,代码行数:14,代码来源:setup.py

示例14: is_package

# 需要导入模块: from distutils.core import setup [as 别名]
# 或者: from distutils.core.setup import py [as 别名]
def is_package(path):
    return (os.path.isdir(path) and os.path.isfile(os.path.join(path, '__init__.py'))) 
开发者ID:bachiraoun,项目名称:fullrmc,代码行数:4,代码来源:setup.py

示例15: get_version

# 需要导入模块: from distutils.core import setup [as 别名]
# 或者: from distutils.core.setup import py [as 别名]
def get_version(package):
    """
    Return package version as listed in `__version__` in `init.py`.
    """
    init_py = open(os.path.join(package, '__init__.py')).read()
    return re.search("^__version__ = ['\"]([^'\"]+)['\"]",
                     init_py, re.MULTILINE).group(1) 
开发者ID:contentful,项目名称:contentful.py,代码行数:9,代码来源:setup.py


注:本文中的distutils.core.setup.py方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。