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


Python setup.py方法代码示例

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


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

示例1: run

# 需要导入模块: from setuptools import setup [as 别名]
# 或者: from setuptools.setup import py [as 别名]
def run(self):
        try:
            self.status('Removing previous builds…')
            rmtree(os.path.join(here, 'dist'))
        except OSError:
            pass

        self.status('Building Source and Wheel (universal) distribution…')
        os.system('{0} setup.py sdist bdist_wheel --universal'.format(
            sys.executable
        ))

        self.status('Uploading the package to PyPi via Twine…')
        os.system('twine upload dist/*')

        sys.exit() 
开发者ID:apirobot,项目名称:django-rest-polymorphic,代码行数:18,代码来源:setup.py

示例2: update_version_py

# 需要导入模块: from setuptools import setup [as 别名]
# 或者: from setuptools.setup import py [as 别名]
def update_version_py():
    if not os.path.isdir(".git"):
        print("This does not appear to be a Git repository.")
        return
    try:
        # p = subprocess.Popen(["git", "describe","--tags", "--always"],
        #        stdout=subprocess.PIPE)
        p = subprocess.Popen("git rev-list HEAD --count".split(),
                             stdout=subprocess.PIPE)

    except EnvironmentError:
        print("unable to run git, leaving eden/_version.py alone")
        return
    stdout = p.communicate()[0]
    if p.returncode != 0:
        print("unable to run git, leaving eden/_version.py alone")
        return
    ver = "0.3."+stdout.strip()
    # ver = str(int(ver,16)) # pypi doesnt like base 16
    f = open("eden/_version.py", "w")
    f.write(VERSION_PY % ver)
    f.close()
    print("set eden/_version.py to '%s'" % ver) 
开发者ID:fabriziocosta,项目名称:EDeN,代码行数:25,代码来源:setup.py

示例3: run

# 需要导入模块: from setuptools import setup [as 别名]
# 或者: from setuptools.setup import py [as 别名]
def run(self):
        try:
            self.status('Removing previous builds...')
            rmtree(os.path.join(base_path, 'dist'))
        except OSError:
            pass

        self.status('Building Source and Wheel (universal) distribution...')
        os.system('{0} setup.py sdist bdist_wheel'.format(sys.executable))

        self.status('Pushing git tags...')
        os.system('git tag v{0}'.format(get_version()))
        os.system('git push --tags')

        try:
            self.status('Removing build artifacts...')
            rmtree(os.path.join(base_path, 'build'))
            rmtree(os.path.join(base_path, '{}.egg-info'.format(PACKAGE_NAME)))
        except OSError:
            pass

        sys.exit() 
开发者ID:titu1994,项目名称:keras_mixnets,代码行数:24,代码来源:setup.py

示例4: tar_and_copy_usr_dir

# 需要导入模块: from setuptools import setup [as 别名]
# 或者: from setuptools.setup import py [as 别名]
def tar_and_copy_usr_dir(usr_dir, train_dir):
  """Package, tar, and copy usr_dir to GCS train_dir."""
  tf.logging.info("Tarring and pushing t2t_usr_dir.")
  usr_dir = os.path.abspath(os.path.expanduser(usr_dir))
  # Copy usr dir to a temp location
  top_dir = os.path.join(tempfile.gettempdir(), "t2t_usr_container")
  tmp_usr_dir = os.path.join(top_dir, usr_dir_lib.INTERNAL_USR_DIR_PACKAGE)
  shutil.rmtree(top_dir, ignore_errors=True)
  shutil.copytree(usr_dir, tmp_usr_dir)
  # Insert setup.py if one does not exist
  top_setup_fname = os.path.join(top_dir, "setup.py")
  setup_file_str = get_setup_file(
      name="DummyUsrDirPackage",
      packages=get_requirements(usr_dir)
  )
  with tf.gfile.Open(top_setup_fname, "w") as f:
    f.write(setup_file_str)
  usr_tar = _tar_and_copy(top_dir, train_dir)
  return usr_tar 
开发者ID:akzaidi,项目名称:fine-lm,代码行数:21,代码来源:cloud_mlengine.py

示例5: test_build_calmjs_artifact

# 需要导入模块: from setuptools import setup [as 别名]
# 或者: from setuptools.setup import py [as 别名]
def test_build_calmjs_artifact(self):
        """
        Emulate the execution of ``python setup.py egg_info``.

        Ensure everything is covered.
        """

        # run the step directly to see that the command is registered,
        # though the actual effects cannot be tested, as the test
        # package is not going to be installed and there are no valid
        # artifact build functions defined.
        p = Popen(
            [sys.executable, 'setup.py', 'build_calmjs_artifacts'],
            stdout=PIPE, stderr=PIPE, cwd=self.pkg_root,
        )
        stdout, stderr = p.communicate()
        stdout = stdout.decode(locale)
        self.assertIn('running build_calmjs_artifacts', stdout) 
开发者ID:calmjs,项目名称:calmjs,代码行数:20,代码来源:test_dist.py

示例6: run

# 需要导入模块: from setuptools import setup [as 别名]
# 或者: from setuptools.setup import py [as 别名]
def run(self):
        try:
            self.status('Removing previous builds…')
            rmtree(os.path.join(here, 'dist'))
        except OSError:
            pass

        self.status('Building Source and Wheel (universal) distribution…')
        os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))

        self.status('Uploading the package to PyPi via Twine…')
        os.system('twine upload dist/*')

        self.status('Pushing git tags…')
        os.system('git tag v{0}'.format(about['__version__']))
        os.system('git push --tags')
        
        sys.exit()


# Where the magic happens: 
开发者ID:zimmerrol,项目名称:keras-utility-layer-collection,代码行数:23,代码来源:setup.py

示例7: _filedefs_contains

# 需要导入模块: from setuptools import setup [as 别名]
# 或者: from setuptools.setup import py [as 别名]
def _filedefs_contains(base, filedefs, path):
    """
    whether `filedefs` defines a file/folder with the given `path`

    `path`, if relative, will be interpreted relative to the `base` folder, and
    whether relative or not, must refer to either the `base` folder or one of
    its direct or indirect children. The base folder itself is considered
    created if the filedefs structure is not empty.

    """
    unknown = object()
    base = py.path.local(base)
    path = _path_join(base, path)

    path_rel_parts = _path_parts(path.relto(base))
    for part in path_rel_parts:
        if not isinstance(filedefs, dict):
            return False
        filedefs = filedefs.get(part, unknown)
        if filedefs is unknown:
            return False
    return path_rel_parts or path == base and filedefs 
开发者ID:tox-dev,项目名称:tox,代码行数:24,代码来源:_pytestplugin.py

示例8: test_getvenv

# 需要导入模块: from setuptools import setup [as 别名]
# 或者: from setuptools.setup import py [as 别名]
def test_getvenv(self, initproj):
        initproj(
            "logexample123-0.5",
            filedefs={
                "tests": {"test_hello.py": "def test_hello(): pass"},
                "tox.ini": """
            [testenv:hello]
            [testenv:world]
            """,
            },
        )
        config = parseconfig([])
        session = Session(config)
        venv1 = session.getvenv("hello")
        venv2 = session.getvenv("hello")
        assert venv1 is venv2
        venv1 = session.getvenv("world")
        venv2 = session.getvenv("world")
        assert venv1 is venv2
        with pytest.raises(LookupError):
            session.getvenv("qwe") 
开发者ID:tox-dev,项目名称:tox,代码行数:23,代码来源:test_z_cmdline.py

示例9: test_envdir_would_delete_some_directory

# 需要导入模块: from setuptools import setup [as 别名]
# 或者: from setuptools.setup import py [as 别名]
def test_envdir_would_delete_some_directory(cmd, initproj):
    projdir = initproj(
        "example-123",
        filedefs={
            "tox.ini": """\
                [tox]

                [testenv:venv]
                envdir=example
                commands=
            """,
        },
    )

    result = cmd("-e", "venv")
    assert projdir.join("example/__init__.py").exists()
    result.assert_fail()
    assert "cowardly refusing to delete `envdir`" in result.out 
开发者ID:tox-dev,项目名称:tox,代码行数:20,代码来源:test_z_cmdline.py

示例10: test_unknown_interpreter_and_env

# 需要导入模块: from setuptools import setup [as 别名]
# 或者: from setuptools.setup import py [as 别名]
def test_unknown_interpreter_and_env(cmd, initproj):
    initproj(
        "interp123-0.5",
        filedefs={
            "tests": {"test_hello.py": "def test_hello(): pass"},
            "tox.ini": """\
                [testenv:python]
                basepython=xyz_unknown_interpreter
                [testenv]
                changedir=tests
                skip_install = true
            """,
        },
    )
    result = cmd()
    result.assert_fail()
    assert "ERROR: InterpreterNotFound: xyz_unknown_interpreter" in result.outlines

    result = cmd("-exyz")
    result.assert_fail()
    assert result.out == "ERROR: unknown environment 'xyz'\n" 
开发者ID:tox-dev,项目名称:tox,代码行数:23,代码来源:test_z_cmdline.py

示例11: test_unknown_interpreter

# 需要导入模块: from setuptools import setup [as 别名]
# 或者: from setuptools.setup import py [as 别名]
def test_unknown_interpreter(cmd, initproj):
    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()
    result.assert_fail()
    assert any(
        "ERROR: InterpreterNotFound: xyz_unknown_interpreter" == line for line in result.outlines
    ), result.outlines 
开发者ID:tox-dev,项目名称:tox,代码行数:20,代码来源:test_z_cmdline.py

示例12: test_skip_platform_mismatch

# 需要导入模块: from setuptools import setup [as 别名]
# 或者: from setuptools.setup import py [as 别名]
def test_skip_platform_mismatch(cmd, initproj):
    initproj(
        "interp123-0.5",
        filedefs={
            "tests": {"test_hello.py": "def test_hello(): pass"},
            "tox.ini": """
            [testenv]
            changedir=tests
            platform=x123
        """,
        },
    )
    result = cmd()
    result.assert_success()
    assert any(
        "SKIPPED:  python: platform mismatch ({!r} does not match 'x123')".format(sys.platform)
        == line
        for line in result.outlines
    ), result.outlines 
开发者ID:tox-dev,项目名称:tox,代码行数:21,代码来源:test_z_cmdline.py

示例13: test_skip_unknown_interpreter_result_json

# 需要导入模块: from setuptools import setup [as 别名]
# 或者: from setuptools.setup import py [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

示例14: test_venv_special_chars_issue252

# 需要导入模块: from setuptools import setup [as 别名]
# 或者: from setuptools.setup import py [as 别名]
def test_venv_special_chars_issue252(cmd, initproj):
    initproj(
        "pkg123-0.7",
        filedefs={
            "tests": {"test_hello.py": "def test_hello(): pass"},
            "tox.ini": """
            [tox]
            envlist = special&&1
            [testenv:special&&1]
            changedir=tests
        """,
        },
    )
    result = cmd()
    result.assert_success()
    pattern = re.compile(r"special&&1 installed: .*pkg123( @ .*-|==)0\.7(\.zip)?.*")
    assert any(pattern.match(line) for line in result.outlines), "\n".join(result.outlines) 
开发者ID:tox-dev,项目名称:tox,代码行数:19,代码来源:test_z_cmdline.py

示例15: test_minimal_setup_py_non_functional

# 需要导入模块: from setuptools import setup [as 别名]
# 或者: from setuptools.setup import py [as 别名]
def test_minimal_setup_py_non_functional(cmd, initproj):
    initproj(
        "pkg123-0.7",
        filedefs={
            "tests": {"test_hello.py": "def test_hello(): pass"},
            "setup.py": """
        import sys

        """,
            "tox.ini": "",
        },
    )
    result = cmd()
    result.assert_fail()
    assert any(
        re.match(r".*ERROR.*check setup.py.*", line) for line in result.outlines
    ), result.outlines 
开发者ID:tox-dev,项目名称:tox,代码行数:19,代码来源:test_z_cmdline.py


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