Python setuptools.dist 模块,Distribution() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用setuptools.dist.Distribution()

项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:my-first-blog    作者:AnkurBegining    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def test_create_zipfile(self):
        # Test to make sure zipfile creation handles common cases.
        # This explicitly includes a folder containing an empty folder.

        dist = Distribution()

        cmd = upload_docs(dist)
        cmd.upload_dir = self.upload_dir
        cmd.target_dir = self.upload_dir
        tmp_dir = tempfile.mkdtemp()
        tmp_file = os.path.join(tmp_dir, 'foo.zip')
        try:
            zip_file = cmd.create_zipfile(tmp_file)

            assert zipfile.is_zipfile(tmp_file)

            zip_file = zipfile.ZipFile(tmp_file) # woh...

            assert zip_file.namelist() == ['index.html']

            zip_file.close()
        finally:
            shutil.rmtree(tmp_dir)
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def test_package_data_in_sdist(self):
        """Regression test for pull request #4: ensures that files listed in
        package_data are included in the manifest even if they're not added to
        version control.
        """

        dist = Distribution(SETUP_ATTRS)
        dist.script_name = 'setup.py'
        cmd = sdist(dist)
        cmd.ensure_finalized()

        # squelch output
        quiet()
        try:
            cmd.run()
        finally:
            unquiet()

        manifest = cmd.filelist.files
        self.assertTrue(os.path.join('sdist_test', 'a.txt') in manifest)
        self.assertTrue(os.path.join('sdist_test', 'b.txt') in manifest)
        self.assertTrue(os.path.join('sdist_test', 'c.rst') not in manifest)
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def notest_develop_with_setup_requires(self):

        wanted = ("Could not find suitable distribution for "
                  "Requirement.parse('I-DONT-EXIST')")
        old_dir = os.getcwd()
        os.chdir(self.dir)
        try:
            try:
                dist = Distribution({'setup_requires': ['I_DONT_EXIST']})
            except DistutilsError:
                e = sys.exc_info()[1]
                error = str(e)
                if error ==  wanted:
                    pass
        finally:
            os.chdir(old_dir)
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def test_no_find_links(self):
        # new option '--no-find-links', that blocks find-links added at
        # the project level
        dist = Distribution()
        cmd = easy_install(dist)
        cmd.check_pth_processing = lambda: True
        cmd.no_find_links = True
        cmd.find_links = ['link1', 'link2']
        cmd.install_dir = os.path.join(tempfile.mkdtemp(), 'ok')
        cmd.args = ['ok']
        cmd.ensure_finalized()
        self.assertEqual(cmd.package_index.scanned_urls, {})

        # let's try without it (default behavior)
        cmd = easy_install(dist)
        cmd.check_pth_processing = lambda: True
        cmd.find_links = ['link1', 'link2']
        cmd.install_dir = os.path.join(tempfile.mkdtemp(), 'ok')
        cmd.args = ['ok']
        cmd.ensure_finalized()
        keys = sorted(cmd.package_index.scanned_urls.keys())
        self.assertEqual(keys, ['link1', 'link2'])
项目:jira_worklog_scanner    作者:pgarneau    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:ivaochdoc    作者:ivaoch    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:RPoint    作者:george17-meet    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:RPoint    作者:george17-meet    | 项目源码 | 文件源码
def monkeypatch_method(cls):
    """A function decorator to monkey-patch a method of the same name on the
    given class.
    """

    def wrapper(func):
        orig = getattr(cls, func.__name__, None)
        if orig and not hasattr(orig, '_orig'):  # Already patched
            setattr(func, '_orig', orig)
            setattr(cls, func.__name__, func)
        return func

    return wrapper


# The following classes are used to hack Distribution.command_options a bit
项目:AshsSDK    作者:thehappydinoa    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:habilitacion    作者:GabrielBD    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def test_create_zipfile(self):
        # Test to make sure zipfile creation handles common cases.
        # This explicitly includes a folder containing an empty folder.

        dist = Distribution()

        cmd = upload_docs(dist)
        cmd.upload_dir = self.upload_dir
        cmd.target_dir = self.upload_dir
        tmp_dir = tempfile.mkdtemp()
        tmp_file = os.path.join(tmp_dir, 'foo.zip')
        try:
            zip_file = cmd.create_zipfile(tmp_file)

            assert zipfile.is_zipfile(tmp_file)

            zip_file = zipfile.ZipFile(tmp_file) # woh...

            assert zip_file.namelist() == ['index.html']

            zip_file.close()
        finally:
            shutil.rmtree(tmp_dir)
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def test_package_data_in_sdist(self):
        """Regression test for pull request #4: ensures that files listed in
        package_data are included in the manifest even if they're not added to
        version control.
        """

        dist = Distribution(SETUP_ATTRS)
        dist.script_name = 'setup.py'
        cmd = sdist(dist)
        cmd.ensure_finalized()

        # squelch output
        quiet()
        try:
            cmd.run()
        finally:
            unquiet()

        manifest = cmd.filelist.files
        self.assertTrue(os.path.join('sdist_test', 'a.txt') in manifest)
        self.assertTrue(os.path.join('sdist_test', 'b.txt') in manifest)
        self.assertTrue(os.path.join('sdist_test', 'c.rst') not in manifest)
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def notest_develop_with_setup_requires(self):

        wanted = ("Could not find suitable distribution for "
                  "Requirement.parse('I-DONT-EXIST')")
        old_dir = os.getcwd()
        os.chdir(self.dir)
        try:
            try:
                dist = Distribution({'setup_requires': ['I_DONT_EXIST']})
            except DistutilsError:
                e = sys.exc_info()[1]
                error = str(e)
                if error ==  wanted:
                    pass
        finally:
            os.chdir(old_dir)
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def test_no_find_links(self):
        # new option '--no-find-links', that blocks find-links added at
        # the project level
        dist = Distribution()
        cmd = easy_install(dist)
        cmd.check_pth_processing = lambda: True
        cmd.no_find_links = True
        cmd.find_links = ['link1', 'link2']
        cmd.install_dir = os.path.join(tempfile.mkdtemp(), 'ok')
        cmd.args = ['ok']
        cmd.ensure_finalized()
        self.assertEqual(cmd.package_index.scanned_urls, {})

        # let's try without it (default behavior)
        cmd = easy_install(dist)
        cmd.check_pth_processing = lambda: True
        cmd.find_links = ['link1', 'link2']
        cmd.install_dir = os.path.join(tempfile.mkdtemp(), 'ok')
        cmd.args = ['ok']
        cmd.ensure_finalized()
        keys = sorted(cmd.package_index.scanned_urls.keys())
        self.assertEqual(keys, ['link1', 'link2'])
项目:calmjs    作者:calmjs    | 项目源码 | 文件源码
def test_view(self):
        stub_mod_call(self, cli)
        tmpdir = mkdtemp(self)
        os.chdir(tmpdir)
        dist = Distribution(dict(
            script_name='setup.py',
            script_args=['yarn', '--view'],
            name='foo',
        ))
        dist.parse_command_line()
        dist.run_commands()

        self.assertFalse(exists(join(tmpdir, 'package.json')))
        # also log handlers removed.
        self.assertEqual(len(getLogger('calmjs.cli').handlers), 0)
        # written to stdout with the correct indentation level.
        self.assertIn('\n        "jquery": "~1.11.0"', sys.stdout.getvalue())
项目:calmjs    作者:calmjs    | 项目源码 | 文件源码
def test_install_no_init_nodevnoprod(self):
        # install implies init
        stub_mod_call(self, cli)
        stub_base_which(self, which_yarn)
        tmpdir = mkdtemp(self)
        os.chdir(tmpdir)
        dist = Distribution(dict(
            script_name='setup.py',
            script_args=['yarn', '--install'],
            name='foo',
        ))
        dist.parse_command_line()
        dist.run_commands()

        with open(os.path.join(tmpdir, 'package.json')) as fd:
            result = json.load(fd)

        # The cli will still automatically write to that, as install
        # implies init.
        self.assertEqual(result, {
            'dependencies': {'jquery': '~1.11.0'},
            'devDependencies': {},
            'name': 'foo',
        })
        self.assertEqual(self.call_args[0], ([which_yarn, 'install'],))
项目:calmjs    作者:calmjs    | 项目源码 | 文件源码
def test_install_init_install_production(self):
        stub_mod_call(self, cli)
        stub_base_which(self, which_yarn)
        tmpdir = mkdtemp(self)
        os.chdir(tmpdir)
        dist = Distribution(dict(
            script_name='setup.py',
            script_args=['yarn', '--init', '--install', '--production'],
            name='foo',
        ))
        dist.parse_command_line()
        dist.run_commands()

        with open(os.path.join(tmpdir, 'package.json')) as fd:
            result = json.load(fd)

        self.assertEqual(result, {
            'dependencies': {'jquery': '~1.11.0'},
            'devDependencies': {},
            'name': 'foo',
        })
        # Should still invoke install
        self.assertEqual(self.call_args[0], (
            [which_yarn, 'install', '--production=true'],))
项目:calmjs    作者:calmjs    | 项目源码 | 文件源码
def test_install_init_install_develop(self):
        stub_mod_call(self, cli)
        stub_base_which(self, which_yarn)
        tmpdir = mkdtemp(self)
        os.chdir(tmpdir)
        dist = Distribution(dict(
            script_name='setup.py',
            script_args=['yarn', '--init', '--install', '--development'],
            name='foo',
        ))
        dist.parse_command_line()
        dist.run_commands()

        with open(os.path.join(tmpdir, 'package.json')) as fd:
            result = json.load(fd)

        self.assertEqual(result, {
            'dependencies': {'jquery': '~1.11.0'},
            'devDependencies': {},
            'name': 'foo',
        })
        # Should still invoke install
        self.assertEqual(self.call_args[0], (
            [which_yarn, 'install', '--production=false'],))
项目:calmjs    作者:calmjs    | 项目源码 | 文件源码
def test_install_view(self):
        stub_mod_call(self, cli)
        stub_base_which(self, which_yarn)
        tmpdir = mkdtemp(self)
        os.chdir(tmpdir)
        dist = Distribution(dict(
            script_name='setup.py',
            script_args=['yarn', '--install', '--view'],
            name='foo',
        ))
        dist.parse_command_line()
        dist.run_commands()

        with open(os.path.join(tmpdir, 'package.json')) as fd:
            result = json.load(fd)

        self.assertEqual(result, {
            'dependencies': {'jquery': '~1.11.0'},
            'devDependencies': {},
            'name': 'foo',
        })
        self.assertEqual(self.call_args[0], ([which_yarn, 'install'],))
项目:calmjs    作者:calmjs    | 项目源码 | 文件源码
def test_view(self):
        stub_mod_call(self, cli)
        tmpdir = mkdtemp(self)
        os.chdir(tmpdir)
        dist = Distribution(dict(
            script_name='setup.py',
            script_args=['npm', '--view'],
            name='foo',
        ))
        dist.parse_command_line()
        dist.run_commands()

        self.assertFalse(exists(join(tmpdir, 'package.json')))
        # also log handlers removed.
        self.assertEqual(len(getLogger('calmjs.cli').handlers), 0)
        # written to stdout with the correct indentation level.
        self.assertIn('\n        "jquery": "~1.11.0"', sys.stdout.getvalue())
项目:calmjs    作者:calmjs    | 项目源码 | 文件源码
def test_install_no_init_nodevnoprod(self):
        # install implies init
        stub_mod_call(self, cli)
        stub_base_which(self, which_npm)
        tmpdir = mkdtemp(self)
        os.chdir(tmpdir)
        dist = Distribution(dict(
            script_name='setup.py',
            script_args=['npm', '--install'],
            name='foo',
        ))
        dist.parse_command_line()
        dist.run_commands()

        with open(os.path.join(tmpdir, 'package.json')) as fd:
            result = json.load(fd)

        # The cli will still automatically write to that, as install
        # implies init.
        self.assertEqual(result, {
            'dependencies': {'jquery': '~1.11.0'},
            'devDependencies': {},
            'name': 'foo',
        })
        self.assertEqual(self.call_args[0], ([which_npm, 'install'],))
项目:calmjs    作者:calmjs    | 项目源码 | 文件源码
def test_install_init_install_production(self):
        stub_mod_call(self, cli)
        stub_base_which(self, which_npm)
        tmpdir = mkdtemp(self)
        os.chdir(tmpdir)
        dist = Distribution(dict(
            script_name='setup.py',
            script_args=['npm', '--init', '--install', '--production'],
            name='foo',
        ))
        dist.parse_command_line()
        dist.run_commands()

        with open(os.path.join(tmpdir, 'package.json')) as fd:
            result = json.load(fd)

        self.assertEqual(result, {
            'dependencies': {'jquery': '~1.11.0'},
            'devDependencies': {},
            'name': 'foo',
        })
        # Should still invoke install
        self.assertEqual(self.call_args[0], (
            [which_npm, 'install', '--production=true'],))
项目:calmjs    作者:calmjs    | 项目源码 | 文件源码
def test_install_init_install_develop(self):
        stub_mod_call(self, cli)
        stub_base_which(self, which_npm)
        tmpdir = mkdtemp(self)
        os.chdir(tmpdir)
        dist = Distribution(dict(
            script_name='setup.py',
            script_args=['npm', '--init', '--install', '--development'],
            name='foo',
        ))
        dist.parse_command_line()
        dist.run_commands()

        with open(os.path.join(tmpdir, 'package.json')) as fd:
            result = json.load(fd)

        self.assertEqual(result, {
            'dependencies': {'jquery': '~1.11.0'},
            'devDependencies': {},
            'name': 'foo',
        })
        # Should still invoke install
        self.assertEqual(self.call_args[0], (
            [which_npm, 'install', '--production=false'],))
项目:calmjs    作者:calmjs    | 项目源码 | 文件源码
def test_install_dryrun(self):
        stub_mod_call(self, cli)
        tmpdir = mkdtemp(self)
        os.chdir(tmpdir)
        dist = Distribution(dict(
            script_name='setup.py',
            script_args=['npm', '--install', '--dry-run'],
            name='foo',
        ))
        dist.parse_command_line()
        dist.run_commands()

        self.assertFalse(exists(join(tmpdir, 'package.json')))
        # Ensure that install is NOT called.
        self.assertIsNone(self.call_args)
        # also log handlers removed.
        self.assertEqual(len(getLogger('calmjs.cli').handlers), 0)
        # However, default action is view, the package.json should be
        # written to stdout with the correct indentation level.
        self.assertIn('\n        "jquery": "~1.11.0"', sys.stdout.getvalue())
项目:calmjs    作者:calmjs    | 项目源码 | 文件源码
def test_install_view(self):
        stub_mod_call(self, cli)
        stub_base_which(self, which_npm)
        tmpdir = mkdtemp(self)
        os.chdir(tmpdir)
        dist = Distribution(dict(
            script_name='setup.py',
            script_args=['npm', '--install', '--view'],
            name='foo',
        ))
        dist.parse_command_line()
        dist.run_commands()

        with open(os.path.join(tmpdir, 'package.json')) as fd:
            result = json.load(fd)

        self.assertEqual(result, {
            'dependencies': {'jquery': '~1.11.0'},
            'devDependencies': {},
            'name': 'foo',
        })
        self.assertEqual(self.call_args[0], ([which_npm, 'install'],))
项目:flickr_downloader    作者:Denisolt    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:RealtimePythonChat    作者:quangtqag    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:Indushell    作者:SecarmaLabs    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:SHAREOpenRefineWkshop    作者:cmh2166    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:Liljimbo-Chatbot    作者:chrisjim316    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:news-for-good    作者:thecodinghub    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:CaScale    作者:Thatsillogical    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def test_create_zipfile(self):
        # Test to make sure zipfile creation handles common cases.
        # This explicitly includes a folder containing an empty folder.

        dist = Distribution()

        cmd = upload_docs(dist)
        cmd.upload_dir = self.upload_dir
        cmd.target_dir = self.upload_dir
        tmp_dir = tempfile.mkdtemp()
        tmp_file = os.path.join(tmp_dir, 'foo.zip')
        try:
            zip_file = cmd.create_zipfile(tmp_file)

            assert zipfile.is_zipfile(tmp_file)

            zip_file = zipfile.ZipFile(tmp_file) # woh...

            assert zip_file.namelist() == ['index.html']

            zip_file.close()
        finally:
            shutil.rmtree(tmp_dir)
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def test_package_data_in_sdist(self):
        """Regression test for pull request #4: ensures that files listed in
        package_data are included in the manifest even if they're not added to
        version control.
        """

        dist = Distribution(SETUP_ATTRS)
        dist.script_name = 'setup.py'
        cmd = sdist(dist)
        cmd.ensure_finalized()

        # squelch output
        quiet()
        try:
            cmd.run()
        finally:
            unquiet()

        manifest = cmd.filelist.files
        self.assertTrue(os.path.join('sdist_test', 'a.txt') in manifest)
        self.assertTrue(os.path.join('sdist_test', 'b.txt') in manifest)
        self.assertTrue(os.path.join('sdist_test', 'c.rst') not in manifest)
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def notest_develop_with_setup_requires(self):

        wanted = ("Could not find suitable distribution for "
                  "Requirement.parse('I-DONT-EXIST')")
        old_dir = os.getcwd()
        os.chdir(self.dir)
        try:
            try:
                dist = Distribution({'setup_requires': ['I_DONT_EXIST']})
            except DistutilsError:
                e = sys.exc_info()[1]
                error = str(e)
                if error ==  wanted:
                    pass
        finally:
            os.chdir(old_dir)
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def test_no_find_links(self):
        # new option '--no-find-links', that blocks find-links added at
        # the project level
        dist = Distribution()
        cmd = easy_install(dist)
        cmd.check_pth_processing = lambda: True
        cmd.no_find_links = True
        cmd.find_links = ['link1', 'link2']
        cmd.install_dir = os.path.join(tempfile.mkdtemp(), 'ok')
        cmd.args = ['ok']
        cmd.ensure_finalized()
        self.assertEqual(cmd.package_index.scanned_urls, {})

        # let's try without it (default behavior)
        cmd = easy_install(dist)
        cmd.check_pth_processing = lambda: True
        cmd.find_links = ['link1', 'link2']
        cmd.install_dir = os.path.join(tempfile.mkdtemp(), 'ok')
        cmd.args = ['ok']
        cmd.ensure_finalized()
        keys = sorted(cmd.package_index.scanned_urls.keys())
        self.assertEqual(keys, ['link1', 'link2'])
项目:where2live    作者:fbessez    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:Tencent_Cartoon_Download    作者:Fretice    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:coolrelation    作者:mrtial    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:Price-Comparator    作者:Thejas-1    | 项目源码 | 文件源码
def test_create_zipfile(self):
        # Test to make sure zipfile creation handles common cases.
        # This explicitly includes a folder containing an empty folder.

        dist = Distribution()

        cmd = upload_docs(dist)
        cmd.upload_dir = self.upload_dir
        cmd.target_dir = self.upload_dir
        tmp_dir = tempfile.mkdtemp()
        tmp_file = os.path.join(tmp_dir, 'foo.zip')
        try:
            zip_file = cmd.create_zipfile(tmp_file)

            assert zipfile.is_zipfile(tmp_file)

            zip_file = zipfile.ZipFile(tmp_file) # woh...

            assert zip_file.namelist() == ['index.html']

            zip_file.close()
        finally:
            shutil.rmtree(tmp_dir)
项目:Price-Comparator    作者:Thejas-1    | 项目源码 | 文件源码
def test_package_data_in_sdist(self):
        """Regression test for pull request #4: ensures that files listed in
        package_data are included in the manifest even if they're not added to
        version control.
        """

        dist = Distribution(SETUP_ATTRS)
        dist.script_name = 'setup.py'
        cmd = sdist(dist)
        cmd.ensure_finalized()

        # squelch output
        quiet()
        try:
            cmd.run()
        finally:
            unquiet()

        manifest = cmd.filelist.files
        self.assertTrue(os.path.join('sdist_test', 'a.txt') in manifest)
        self.assertTrue(os.path.join('sdist_test', 'b.txt') in manifest)
        self.assertTrue(os.path.join('sdist_test', 'c.rst') not in manifest)
项目:Price-Comparator    作者:Thejas-1    | 项目源码 | 文件源码
def notest_develop_with_setup_requires(self):

        wanted = ("Could not find suitable distribution for "
                  "Requirement.parse('I-DONT-EXIST')")
        old_dir = os.getcwd()
        os.chdir(self.dir)
        try:
            try:
                dist = Distribution({'setup_requires': ['I_DONT_EXIST']})
            except DistutilsError:
                e = sys.exc_info()[1]
                error = str(e)
                if error ==  wanted:
                    pass
        finally:
            os.chdir(old_dir)
项目:Price-Comparator    作者:Thejas-1    | 项目源码 | 文件源码
def test_no_find_links(self):
        # new option '--no-find-links', that blocks find-links added at
        # the project level
        dist = Distribution()
        cmd = easy_install(dist)
        cmd.check_pth_processing = lambda: True
        cmd.no_find_links = True
        cmd.find_links = ['link1', 'link2']
        cmd.install_dir = os.path.join(tempfile.mkdtemp(), 'ok')
        cmd.args = ['ok']
        cmd.ensure_finalized()
        self.assertEqual(cmd.package_index.scanned_urls, {})

        # let's try without it (default behavior)
        cmd = easy_install(dist)
        cmd.check_pth_processing = lambda: True
        cmd.find_links = ['link1', 'link2']
        cmd.install_dir = os.path.join(tempfile.mkdtemp(), 'ok')
        cmd.args = ['ok']
        cmd.ensure_finalized()
        keys = sorted(cmd.package_index.scanned_urls.keys())
        self.assertEqual(keys, ['link1', 'link2'])
项目:python-group-proj    作者:Sharcee    | 项目源码 | 文件源码
def parse_configuration(
        distribution, command_options, ignore_option_errors=False):
    """Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    """
    meta = ConfigMetadataHandler(
        distribution.metadata, command_options, ignore_option_errors)
    meta.parse()

    options = ConfigOptionsHandler(
        distribution, command_options, ignore_option_errors)
    options.parse()

    return [meta, options]
项目:Flask-NvRay-Blog    作者:rui7157    | 项目源码 | 文件源码
def test_create_zipfile(self):
        # Test to make sure zipfile creation handles common cases.
        # This explicitly includes a folder containing an empty folder.

        dist = Distribution()

        cmd = upload_docs(dist)
        cmd.upload_dir = self.upload_dir
        cmd.target_dir = self.upload_dir
        tmp_dir = tempfile.mkdtemp()
        tmp_file = os.path.join(tmp_dir, 'foo.zip')
        try:
            zip_file = cmd.create_zipfile(tmp_file)

            assert zipfile.is_zipfile(tmp_file)

            zip_file = zipfile.ZipFile(tmp_file) # woh...

            assert zip_file.namelist() == ['index.html']

            zip_file.close()
        finally:
            shutil.rmtree(tmp_dir)