python类setup()的实例源码

test_upload_docs.py 文件源码 项目:Flask_Blog 作者: sugarguo 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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.upload_dir = os.path.join(self.dir, 'build')
        os.mkdir(self.upload_dir)

        # A test document.
        f = open(os.path.join(self.upload_dir, 'index.html'), 'w')
        f.write("Hello world.")
        f.close()

        # An empty folder.
        os.mkdir(os.path.join(self.upload_dir, 'empty'))

        if sys.version >= "2.6":
            self.old_base = site.USER_BASE
            site.USER_BASE = upload_docs.USER_BASE = tempfile.mkdtemp()
            self.old_site = site.USER_SITE
            site.USER_SITE = upload_docs.USER_SITE = tempfile.mkdtemp()
test_easy_install.py 文件源码 项目:Flask_Blog 作者: sugarguo 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
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
test_easy_install.py 文件源码 项目:Flask_Blog 作者: sugarguo 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def create_sdist():
        """
        Return an sdist with a setup_requires dependency (of something that
        doesn't exist)
        """
        with tempdir_context() as dir:
            dist_path = os.path.join(dir, 'setuptools-test-fetcher-1.0.tar.gz')
            make_trivial_sdist(
                dist_path,
                textwrap.dedent("""
                    import setuptools
                    setuptools.setup(
                        name="setuptools-test-fetcher",
                        version="1.0",
                        setup_requires = ['does-not-exist'],
                    )
                """).lstrip())
            yield dist_path
test_easy_install.py 文件源码 项目:Flask_Blog 作者: sugarguo 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def make_trivial_sdist(dist_path, setup_py):
    """Create a simple sdist tarball at dist_path, containing just a
    setup.py, the contents of which are provided by the setup_py string.
    """

    setup_py_file = tarfile.TarInfo(name='setup.py')
    try:
        # Python 3 (StringIO gets converted to io module)
        MemFile = BytesIO
    except AttributeError:
        MemFile = StringIO
    setup_py_bytes = MemFile(setup_py.encode('utf-8'))
    setup_py_file.size = len(setup_py_bytes.getvalue())
    dist = tarfile.open(dist_path, 'w:gz')
    try:
        dist.addfile(setup_py_file, fileobj=setup_py_bytes)
    finally:
        dist.close()
conftest.py 文件源码 项目:detox 作者: tox-dev 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def create_example1(tmpdir):
    tmpdir.join("setup.py").write(d("""
        from setuptools import setup

        def main():
            setup(
                name='example1',
                description='example1 project for testing detox',
                version='0.4',
                packages=['example1',],
            )
        if __name__ == '__main__':
            main()
    """))
    tmpdir.join("tox.ini").write(d("""
        [testenv:py]
    """))
    tmpdir.join("example1", "__init__.py").ensure()
test_packaging.py 文件源码 项目:shopify_python 作者: Shopify 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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
test_integration.py 文件源码 项目:devsecops-example-helloworld 作者: boozallen 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def all_projects():
    if not REPODIR:
        return
    # Future: make this path parameterisable.
    excludes = set(['pypi-mirror', 'jeepyb', 'tempest', 'requirements'])
    for name in PROJECTS:
        name = name.strip()
        short_name = name.split('/')[-1]
        try:
            with open(os.path.join(
                    REPODIR, short_name, 'setup.py'), 'rt') as f:
                if 'pbr' not in f.read():
                    continue
        except IOError:
            continue
        if short_name in excludes:
            continue
        yield (short_name, dict(name=name, short_name=short_name))
setup.py 文件源码 项目:filefinder2 作者: asmodehn 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def run(self):
        """runner"""

        # TODO :
        # $ gitchangelog >CHANGELOG.rst
        # change version in code and changelog
        subprocess.check_call(
            "git commit CHANGELOG.rst filefinder2/_version.py -m 'v{0}'".format(__version__), shell=True)
        subprocess.check_call("git push", shell=True)

        print("You should verify travis checks, and you can publish this release with :")
        print("  python setup.py publish")
        sys.exit()

# Clean way to add a custom "python setup.py <command>"
# Ref setup.py command extension : https://blog.niteoweb.com/setuptools-run-custom-code-in-setup-py/
setup.py 文件源码 项目:cbor_py 作者: brianolson 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def main():
    """ Perform setup with optional C speedups.

    Optional extension compilation stolen from markupsafe, which again stole
    it from simplejson. Creds to Bob Ippolito for the original code.
    """
    is_jython = 'java' in sys.platform
    is_pypy = hasattr(sys, 'pypy_translation_info')

    if is_jython or is_pypy:
        del setup_options['ext_modules']

    try:
        setup(**setup_options)
    except BuildError as be:
        sys.stderr.write('''
BUILD ERROR:
  %s
RETRYING WITHOUT C EXTENSIONS
''' % (be,))
        del setup_options['ext_modules']
        setup(**setup_options)
test_packaging.py 文件源码 项目:RPoint 作者: george17-meet 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def _setUp(self):
        tmpdir = self.useFixture(fixtures.TempDir()).path
        package_dirs = {}
        for pkg_name in self.packages:
            pkg_path = os.path.join(tmpdir, pkg_name)
            package_dirs[pkg_name] = pkg_path
            os.mkdir(pkg_path)
            for cf in ['setup.py', 'setup.cfg']:
                if cf in self.packages[pkg_name]:
                    contents = self.packages[pkg_name].pop(cf)
                else:
                    contents = self.defaults[cf].format(pkg_name=pkg_name)
                self._writeFile(pkg_path, cf, contents)

            for cf in self.packages[pkg_name]:
                self._writeFile(pkg_path, cf, self.packages[pkg_name][cf])
            self.useFixture(TestRepo(pkg_path)).commit()
        self.addCleanup(delattr, self, 'package_dirs')
        self.package_dirs = package_dirs
        return package_dirs
test_integration.py 文件源码 项目:RPoint 作者: george17-meet 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def all_projects():
    if not REPODIR:
        return
    # Future: make this path parameterisable.
    excludes = set(['tempest', 'requirements'])
    for name in PROJECTS:
        name = name.strip()
        short_name = name.split('/')[-1]
        try:
            with open(os.path.join(
                    REPODIR, short_name, 'setup.py'), 'rt') as f:
                if 'pbr' not in f.read():
                    continue
        except IOError:
            continue
        if short_name in excludes:
            continue
        yield (short_name, dict(name=name, short_name=short_name))
setup.py 文件源码 项目:feature-aggregation 作者: paschalidoud 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def setup_package():
    setup(
        name=NAME,
        version=get_version(),
        description=DESCRIPTION,
        long_description=LONG_DESCRIPTION,
        maintainer=MAINTAINER,
        maintainer_email=MAINTAINER_EMAIL,
        license=LICENSE,
        classifiers=[
            "Intended Audience :: Science/Research",
            "Intended Audience :: Developers",
            "License :: OSI Approved :: MIT License",
            "Topic :: Scientific/Engineering",
            "Programming Language :: Python",
            "Programming Language :: Python :: 2",
            "Programming Language :: Python :: 2.7",
            "Programming Language :: Python :: 3",
            "Programming Language :: Python :: 3.4",
            "Programming Language :: Python :: 3.5",
        ],
        packages=find_packages(exclude=["docs", "tests"]),
        install_requires=["scikit-learn"]
    )
test_upload_docs.py 文件源码 项目:flasky 作者: RoseOu 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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.upload_dir = os.path.join(self.dir, 'build')
        os.mkdir(self.upload_dir)

        # A test document.
        f = open(os.path.join(self.upload_dir, 'index.html'), 'w')
        f.write("Hello world.")
        f.close()

        # An empty folder.
        os.mkdir(os.path.join(self.upload_dir, 'empty'))

        if sys.version >= "2.6":
            self.old_base = site.USER_BASE
            site.USER_BASE = upload_docs.USER_BASE = tempfile.mkdtemp()
            self.old_site = site.USER_SITE
            site.USER_SITE = upload_docs.USER_SITE = tempfile.mkdtemp()
test_easy_install.py 文件源码 项目:flasky 作者: RoseOu 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
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
test_easy_install.py 文件源码 项目:flasky 作者: RoseOu 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def create_sdist():
        """
        Return an sdist with a setup_requires dependency (of something that
        doesn't exist)
        """
        with tempdir_context() as dir:
            dist_path = os.path.join(dir, 'setuptools-test-fetcher-1.0.tar.gz')
            make_trivial_sdist(
                dist_path,
                textwrap.dedent("""
                    import setuptools
                    setuptools.setup(
                        name="setuptools-test-fetcher",
                        version="1.0",
                        setup_requires = ['does-not-exist'],
                    )
                """).lstrip())
            yield dist_path
test_easy_install.py 文件源码 项目:flasky 作者: RoseOu 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def make_trivial_sdist(dist_path, setup_py):
    """Create a simple sdist tarball at dist_path, containing just a
    setup.py, the contents of which are provided by the setup_py string.
    """

    setup_py_file = tarfile.TarInfo(name='setup.py')
    try:
        # Python 3 (StringIO gets converted to io module)
        MemFile = BytesIO
    except AttributeError:
        MemFile = StringIO
    setup_py_bytes = MemFile(setup_py.encode('utf-8'))
    setup_py_file.size = len(setup_py_bytes.getvalue())
    dist = tarfile.open(dist_path, 'w:gz')
    try:
        dist.addfile(setup_py_file, fileobj=setup_py_bytes)
    finally:
        dist.close()
setup.py 文件源码 项目:rosimport 作者: pyros-dev 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def run(self):
        """runner"""

        # TODO :
        # $ gitchangelog >CHANGELOG.rst
        # change version in code and changelog
        subprocess.check_call(
            "git commit CHANGELOG.rst rosimport/_version.py -m 'v{0}'".format(__version__), shell=True)
        subprocess.check_call("git push", shell=True)

        print("You should verify travis checks, and you can publish this release with :")
        print("  python setup.py publish")
        sys.exit()

# Clean way to add a custom "python setup.py <command>"
# Ref setup.py command extension : https://blog.niteoweb.com/setuptools-run-custom-code-in-setup-py/
setup_boilerplate.py 文件源码 项目:static-typing 作者: mbdevpl 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def setup(cls) -> None:
        """Run setuptools.setup() with correct arguments."""
        setuptools.setup(
            name=cls.name, version=find_version(cls.name), description=cls.description,
            long_description=parse_readme(), url=cls.url, download_url=cls.download_url,
            author=cls.author, author_email=cls.author_email,
            maintainer=cls.try_fields('maintainer', 'author'),
            maintainer_email=cls.try_fields('maintainer_email', 'author_email'),
            license=cls.license_str, classifiers=cls.classifiers, keywords=cls.keywords,
            packages=find_packages(cls.root_directory), package_dir={'': cls.root_directory},
            include_package_data=True,
            package_data=cls.package_data, exclude_package_data=cls.exclude_package_data,
            install_requires=parse_requirements(), extras_require=cls.extras_require,
            python_requires=find_required_python_version(cls.classifiers),
            entry_points=cls.entry_points, test_suite=cls.test_suite
            )
autodetect.py 文件源码 项目:rcli 作者: contains-io 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def setup_keyword(dist, _, value):
    # type: (setuptools.dist.Distribution, str, bool) -> None
    """Add autodetected commands as entry points.

    Args:
        dist: The distutils Distribution object for the project being
            installed.
        _: The keyword used in the setup function. Unused.
        value: The value set to the keyword in the setup function. If the value
            is not True, this function will do nothing.
    """
    if value is not True:
        return
    if dist.entry_points is None:
        dist.entry_points = {}
    for command, subcommands in six.iteritems(_get_commands(dist)):
        entry_point = '{command} = rcli.dispatcher:main'.format(
            command=command)
        entry_points = dist.entry_points.setdefault('console_scripts', [])
        if entry_point not in entry_points:
            entry_points.append(entry_point)
        dist.entry_points.setdefault('rcli', []).extend(subcommands)
autodetect.py 文件源码 项目:rcli 作者: contains-io 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def _get_module_commands(module):
    # type: (ast.Module) -> typing.Generator[_EntryPoint, None, None]
    """Yield all Command objects represented by the python module.

    Module commands consist of a docopt-style module docstring and a callable
    Command class.

    Args:
        module: An ast.Module object used to retrieve docopt-style commands.

    Yields:
        Command objects that represent entry points to append to setup.py.
    """
    cls = next((n for n in module.body
                if isinstance(n, ast.ClassDef) and n.name == 'Command'), None)
    if not cls:
        return
    methods = (n.name for n in cls.body if isinstance(n, ast.FunctionDef))
    if '__call__' not in methods:
        return
    docstring = ast.get_docstring(module)
    for commands, _ in usage.parse_commands(docstring):
        yield _EntryPoint(commands[0], next(iter(commands[1:]), None), None)
autodetect.py 文件源码 项目:rcli 作者: contains-io 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _get_class_commands(module):
    # type: (ast.Module) -> typing.Generator[_EntryPoint, None, None]
    """Yield all Command objects represented by python classes in the module.

    Class commands are detected by inspecting all callable classes in the
    module for docopt-style docstrings.

    Args:
        module: An ast.Module object used to retrieve docopt-style commands.

    Yields:
        Command objects that represent entry points to append to setup.py.
    """
    nodes = (n for n in module.body if isinstance(n, ast.ClassDef))
    for cls in nodes:
        methods = (n.name for n in cls.body if isinstance(n, ast.FunctionDef))
        if '__call__' in methods:
            docstring = ast.get_docstring(cls)
            for commands, _ in usage.parse_commands(docstring):
                yield _EntryPoint(commands[0], next(iter(commands[1:]), None),
                                  cls.name)
autodetect.py 文件源码 项目:rcli 作者: contains-io 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def _get_function_commands(module):
    # type: (ast.Module) -> typing.Generator[_EntryPoint, None, None]
    """Yield all Command objects represented by python functions in the module.

    Function commands consist of all top-level functions that contain
    docopt-style docstrings.

    Args:
        module: An ast.Module object used to retrieve docopt-style commands.

    Yields:
        Command objects that represent entry points to append to setup.py.
    """
    nodes = (n for n in module.body if isinstance(n, ast.FunctionDef))
    for func in nodes:
        docstring = ast.get_docstring(func)
        for commands, _ in usage.parse_commands(docstring):
            yield _EntryPoint(commands[0], next(iter(commands[1:]), None),
                              func.name)
setup.py 文件源码 项目:acefile 作者: droe 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def run_setup(with_optional_extensions):
    if with_optional_extensions:
        ext_modules=[Extension(
            "acebitstream", ["c/acebitstream_mod.c", "c/acebitstream.c"],
            define_macros=[(sys.byteorder.upper()+'_ENDIAN_SWAP', 1)]
        )]
    else:
        ext_modules=[]

    setup(
        name='acefile',
        version=acefile.__version__,
        description=title,
        long_description=desc,
        url=acefile.__url__,
        author=acefile.__author__,
        author_email=acefile.__email__,
        license=acefile.__license__,
        platforms=['all'],
        classifiers=[
            # https://pypi.python.org/pypi?%3Aaction=list_classifiers
            'Development Status :: 4 - Beta',
            'License :: OSI Approved :: BSD License',
            'Operating System :: OS Independent',
            'Programming Language :: Python :: 3',
            'Programming Language :: Python :: 3.3',
            'Programming Language :: Python :: 3.4',
            'Programming Language :: Python :: 3.5',
            'Programming Language :: Python :: 3.6',
            'Topic :: System :: Archiving :: Compression',
        ],
        keywords=['ace', 'unace', 'compression', 'decompression', 'archive'],
        py_modules=['acefile'],
        ext_modules=ext_modules,
        entry_points = {
            'console_scripts': [
                'acefile-unace=acefile:unace',
            ],
        },
        test_suite = 'acefile.testsuite',
    )
test_upload_docs.py 文件源码 项目:chihu 作者: yelongyu 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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.upload_dir = os.path.join(self.dir, 'build')
        os.mkdir(self.upload_dir)

        # A test document.
        f = open(os.path.join(self.upload_dir, 'index.html'), 'w')
        f.write("Hello world.")
        f.close()

        # An empty folder.
        os.mkdir(os.path.join(self.upload_dir, 'empty'))

        if sys.version >= "2.6":
            self.old_base = site.USER_BASE
            site.USER_BASE = upload_docs.USER_BASE = tempfile.mkdtemp()
            self.old_site = site.USER_SITE
            site.USER_SITE = upload_docs.USER_SITE = tempfile.mkdtemp()
test_easy_install.py 文件源码 项目:chihu 作者: yelongyu 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
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
test_easy_install.py 文件源码 项目:chihu 作者: yelongyu 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def create_sdist():
        """
        Return an sdist with a setup_requires dependency (of something that
        doesn't exist)
        """
        with tempdir_context() as dir:
            dist_path = os.path.join(dir, 'setuptools-test-fetcher-1.0.tar.gz')
            make_trivial_sdist(
                dist_path,
                textwrap.dedent("""
                    import setuptools
                    setuptools.setup(
                        name="setuptools-test-fetcher",
                        version="1.0",
                        setup_requires = ['does-not-exist'],
                    )
                """).lstrip())
            yield dist_path
test_easy_install.py 文件源码 项目:chihu 作者: yelongyu 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def make_trivial_sdist(dist_path, setup_py):
    """Create a simple sdist tarball at dist_path, containing just a
    setup.py, the contents of which are provided by the setup_py string.
    """

    setup_py_file = tarfile.TarInfo(name='setup.py')
    try:
        # Python 3 (StringIO gets converted to io module)
        MemFile = BytesIO
    except AttributeError:
        MemFile = StringIO
    setup_py_bytes = MemFile(setup_py.encode('utf-8'))
    setup_py_file.size = len(setup_py_bytes.getvalue())
    dist = tarfile.open(dist_path, 'w:gz')
    try:
        dist.addfile(setup_py_file, fileobj=setup_py_bytes)
    finally:
        dist.close()
magic.py 文件源码 项目:ipybind 作者: aldanor 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def build_module(self, module, source, args):
        keys, values = list(zip(*args.env)) or ((), ())
        env = dict(zip(map(str.strip, keys), values))
        with override_vars(os.environ, **env):
            workdir = cache_path(module)
            os.makedirs(workdir, exist_ok=True)
            script_args = ['-v' if args.verbose else '-q']
            script_args += ['build_ext', '--inplace', '--build-temp', workdir]
            if args.force:
                script_args.append('--force')
            if args.compiler is not None:
                script_args += ['--compiler', args.compiler]
            warnings.filterwarnings('ignore', 'To exit')
            setuptools.setup(
                name=module,
                ext_modules=[self.make_extension(module, source, args)],
                script_args=script_args,
                cmdclass={'build_ext': build_ext}
            )
test_upload_docs.py 文件源码 项目:Price-Comparator 作者: Thejas-1 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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.upload_dir = os.path.join(self.dir, 'build')
        os.mkdir(self.upload_dir)

        # A test document.
        f = open(os.path.join(self.upload_dir, 'index.html'), 'w')
        f.write("Hello world.")
        f.close()

        # An empty folder.
        os.mkdir(os.path.join(self.upload_dir, 'empty'))

        if sys.version >= "2.6":
            self.old_base = site.USER_BASE
            site.USER_BASE = upload_docs.USER_BASE = tempfile.mkdtemp()
            self.old_site = site.USER_SITE
            site.USER_SITE = upload_docs.USER_SITE = tempfile.mkdtemp()
test_easy_install.py 文件源码 项目:Price-Comparator 作者: Thejas-1 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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


问题


面经


文章

微信
公众号

扫码关注公众号