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


Python setuptools.setup方法代码示例

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


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

示例1: package_source_root

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import setup [as 别名]
def package_source_root(tmpdir):
    # type: ('py.path.LocalPath') -> 'py.path.LocalPath'
    root = tmpdir.join('test_packaging')

    root.join('setup.py').write("""
import setuptools
setuptools.setup(
    name='test_packaging',
    install_requires=[
        'shopify_python'
    ],
    entry_points={
        'egg_info.writers': [
            'git_sha.txt = shopify_python.packaging:write_package_revision',
        ],
    }
)
    """, ensure=True)
    return root 
开发者ID:Shopify,项目名称:shopify_python,代码行数:21,代码来源:test_packaging.py

示例2: __enter__

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import setup [as 别名]
def __enter__(self):
        import distutils.core

        self._distutils_setup = distutils.core.setup
        distutils.core.setup = self.distutils_setup_replacement

        try:
            import setuptools

            self._setuptools_setup = setuptools.setup
            setuptools.setup = self.setuptools_setup_replacement
        except ImportError:
            self._setuptools_setup = None

        self._kw = {}
        return self 
开发者ID:regebro,项目名称:pyroma,代码行数:18,代码来源:projectdata.py

示例3: test_skip_unknown_interpreter_result_json

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import setup [as 别名]
def test_skip_unknown_interpreter_result_json(cmd, initproj, tmpdir):
    report_path = tmpdir.join("toxresult.json")
    initproj(
        "interp123-0.5",
        filedefs={
            "tests": {"test_hello.py": "def test_hello(): pass"},
            "tox.ini": """
            [testenv:python]
            basepython=xyz_unknown_interpreter
            [testenv]
            changedir=tests
        """,
        },
    )
    result = cmd("--skip-missing-interpreters", "--result-json", report_path)
    result.assert_success()
    msg = "SKIPPED:  python: InterpreterNotFound: xyz_unknown_interpreter"
    assert any(msg == line for line in result.outlines), result.outlines
    setup_result_from_json = json.load(report_path)["testenvs"]["python"]["setup"]
    for setup_step in setup_result_from_json:
        assert "InterpreterNotFound" in setup_step["output"]
        assert setup_step["retcode"] == 0 
开发者ID:tox-dev,项目名称:tox,代码行数:24,代码来源:test_z_cmdline.py

示例4: test_sdist_fails

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import setup [as 别名]
def test_sdist_fails(cmd, initproj):
    initproj(
        "pkg123-0.7",
        filedefs={
            "tests": {"test_hello.py": "def test_hello(): pass"},
            "setup.py": """
            syntax error
        """,
            "tox.ini": "",
        },
    )
    result = cmd()
    result.assert_fail()
    assert any(
        re.match(r".*FAIL.*could not package project.*", line) for line in result.outlines
    ), result.outlines 
开发者ID:tox-dev,项目名称:tox,代码行数:18,代码来源:test_z_cmdline.py

示例5: test_no_setup_py_exits

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import setup [as 别名]
def test_no_setup_py_exits(cmd, initproj):
    initproj(
        "pkg123-0.7",
        filedefs={
            "tox.ini": """
            [testenv]
            commands=python -c "2 + 2"
        """,
        },
    )
    os.remove("setup.py")
    result = cmd()
    result.assert_fail()
    assert any(
        re.match(r".*ERROR.*No pyproject.toml or setup.py file found.*", line)
        for line in result.outlines
    ), result.outlines 
开发者ID:tox-dev,项目名称:tox,代码行数:19,代码来源:test_z_cmdline.py

示例6: test_no_setup_py_exits_but_pyproject_toml_does

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import setup [as 别名]
def test_no_setup_py_exits_but_pyproject_toml_does(cmd, initproj):
    initproj(
        "pkg123-0.7",
        filedefs={
            "tox.ini": """
            [testenv]
            commands=python -c "2 + 2"
        """,
        },
    )
    os.remove("setup.py")
    pathlib2.Path("pyproject.toml").touch()
    result = cmd()
    result.assert_fail()
    assert any(
        re.match(r".*ERROR.*pyproject.toml file found.*", line) for line in result.outlines
    ), result.outlines
    assert any(
        re.match(r".*To use a PEP 517 build-backend you are required to*", line)
        for line in result.outlines
    ), result.outlines 
开发者ID:tox-dev,项目名称:tox,代码行数:23,代码来源:test_z_cmdline.py

示例7: test_package_install_fails

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import setup [as 别名]
def test_package_install_fails(cmd, initproj):
    initproj(
        "pkg123-0.7",
        filedefs={
            "tests": {"test_hello.py": "def test_hello(): pass"},
            "setup.py": """
            from setuptools import setup
            setup(
                name='pkg123',
                description='pkg123 project',
                version='0.7',
                license='MIT',
                platforms=['unix', 'win32'],
                packages=['pkg123',],
                install_requires=['qweqwe123'],
                )
            """,
            "tox.ini": "",
        },
    )
    result = cmd()
    result.assert_fail()
    assert result.outlines[-1].startswith("ERROR:   python: InvocationError for command ") 
开发者ID:tox-dev,项目名称:tox,代码行数:25,代码来源:test_z_cmdline.py

示例8: test_devenv

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import setup [as 别名]
def test_devenv(initproj, cmd):
    initproj(
        "example123",
        filedefs={
            "setup.py": """\
                from setuptools import setup
                setup(name='x')
            """,
            "tox.ini": """\
            [tox]
            # envlist is ignored for --devenv
            envlist = foo,bar,baz

            [testenv]
            # --devenv implies --notest
            commands = python -c "exit(1)"
            """,
        },
    )
    result = cmd("--devenv", "venv")
    result.assert_success()
    # `--devenv` defaults to the `py` environment and a develop install
    assert "py develop-inst:" in result.out
    assert re.search("py create:.*venv", result.out) 
开发者ID:tox-dev,项目名称:tox,代码行数:26,代码来源:test_z_cmdline.py

示例9: test_devenv_does_not_allow_multiple_environments

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import setup [as 别名]
def test_devenv_does_not_allow_multiple_environments(initproj, cmd):
    initproj(
        "example123",
        filedefs={
            "setup.py": """\
                from setuptools import setup
                setup(name='x')
            """,
            "tox.ini": """\
            [tox]
            envlist=foo,bar,baz
            """,
        },
    )

    result = cmd("--devenv", "venv", "-e", "foo,bar")
    result.assert_fail()
    assert result.err == "ERROR: --devenv requires only a single -e\n" 
开发者ID:tox-dev,项目名称:tox,代码行数:20,代码来源:test_z_cmdline.py

示例10: test_devenv_does_not_delete_project

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import setup [as 别名]
def test_devenv_does_not_delete_project(initproj, cmd):
    initproj(
        "example123",
        filedefs={
            "setup.py": """\
                from setuptools import setup
                setup(name='x')
            """,
            "tox.ini": """\
            [tox]
            envlist=foo,bar,baz
            """,
        },
    )

    result = cmd("--devenv", "")
    result.assert_fail()
    assert "would delete project" in result.out
    assert "ERROR: ConfigError: envdir must not equal toxinidir" in result.out 
开发者ID:tox-dev,项目名称:tox,代码行数:21,代码来源:test_z_cmdline.py

示例11: test_setup_prints_non_ascii

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import setup [as 别名]
def test_setup_prints_non_ascii(initproj, cmd):
    initproj(
        "example123",
        filedefs={
            "setup.py": """\
import sys
getattr(sys.stdout, 'buffer', sys.stdout).write(b'\\xe2\\x98\\x83\\n')

import setuptools
setuptools.setup(name='example123')
""",
            "tox.ini": "",
        },
    )
    result = cmd("--notest")
    result.assert_success()
    assert "create" in result.out 
开发者ID:tox-dev,项目名称:tox,代码行数:19,代码来源:test_z_cmdline.py

示例12: create_setup_file

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import setup [as 别名]
def create_setup_file():
    lib_version = VersionInfo("spotify_tensorflow").version_string()
    contents_for_setup_file = """
    import setuptools
    
    if __name__ == "__main__":
        setuptools.setup(
            name="spotify_tensorflow_dataflow",
            packages=setuptools.find_packages(),
            install_requires=[
                "spotify-tensorflow=={version}"
        ])
    """.format(version=lib_version)  # noqa: W293
    setup_file_path = os.path.join(tempfile.mkdtemp(), "setup.py")
    with open(setup_file_path, "w") as f:
        f.writelines(textwrap.dedent(contents_for_setup_file))
    return setup_file_path 
开发者ID:spotify,项目名称:spotify-tensorflow,代码行数:19,代码来源:utils.py

示例13: make_release_tree

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import setup [as 别名]
def make_release_tree(self, base_dir, files):
        import os
        sdist.make_release_tree(self, base_dir, files)
        version_file = os.path.join(base_dir, 'VERSION')
        print('updating %s' % (version_file,))
        # Write to temporary file first and rename over permanent not
        # just to avoid atomicity issues (not likely an issue since if
        # interrupted the whole sdist directory is only partially
        # written) but because the upstream sdist may have made a hard
        # link, so overwriting in place will edit the source tree.
        with open(version_file + '.tmp', 'wb') as f:
            f.write('%s\n' % (pkg_version,))
        os.rename(version_file + '.tmp', version_file)

# XXX These should be attributes of `setup', but helpful distutils
# doesn't pass them through when it doesn't know about them a priori. 
开发者ID:probcomp,项目名称:cgpm,代码行数:18,代码来源:setup.py

示例14: setUp

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import setup [as 别名]
def setUp(self):
        self.dir = tempfile.mkdtemp()
        setup = os.path.join(self.dir, 'setup.py')
        f = open(setup, 'w')
        f.write(SETUP_PY)
        f.close()
        self.old_cwd = os.getcwd()
        os.chdir(self.dir)

        self.old_enable_site = site.ENABLE_USER_SITE
        self.old_file = easy_install_pkg.__file__
        self.old_base = site.USER_BASE
        site.USER_BASE = tempfile.mkdtemp()
        self.old_site = site.USER_SITE
        site.USER_SITE = tempfile.mkdtemp()
        easy_install_pkg.__file__ = site.USER_SITE 
开发者ID:MayOneUS,项目名称:pledgeservice,代码行数:18,代码来源:test_easy_install.py

示例15: test_setup_requires

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import setup [as 别名]
def test_setup_requires(self):
        """Regression test for Distribute issue #318

        Ensure that a package with setup_requires can be installed when
        setuptools is installed in the user site-packages without causing a
        SandboxViolation.
        """

        test_pkg = create_setup_requires_package(self.dir)
        test_setup_py = os.path.join(test_pkg, 'setup.py')

        try:
            with quiet_context():
                with reset_setup_stop_context():
                    run_setup(test_setup_py, ['install'])
        except SandboxViolation:
            self.fail('Installation caused SandboxViolation')
        except IndexError:
            # Test fails in some cases due to bugs in Python
            # See https://bitbucket.org/pypa/setuptools/issue/201
            pass 
开发者ID:MayOneUS,项目名称:pledgeservice,代码行数:23,代码来源:test_easy_install.py


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