Python setuptools.command.easy_install 模块,CommandSpec() 实例源码

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

项目:Sudoku-Solver    作者:ayush1997    | 项目源码 | 文件源码
def test_get_script_args(self):
        header = ei.CommandSpec.best().from_environment().as_header()
        expected = header + DALS("""
            # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
            __requires__ = 'spec'
            import sys
            from pkg_resources import load_entry_point

            if __name__ == '__main__':
                sys.exit(
                    load_entry_point('spec', 'console_scripts', 'name')()
                )
            """)
        dist = FakeDist()

        args = next(ei.ScriptWriter.get_args(dist))
        name, script = itertools.islice(args, 2)

        assert script == expected
项目:setuptools    作者:pypa    | 项目源码 | 文件源码
def test_get_script_args(self):
        header = ei.CommandSpec.best().from_environment().as_header()
        expected = header + DALS(r"""
            # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
            __requires__ = 'spec'
            import re
            import sys
            from pkg_resources import load_entry_point

            if __name__ == '__main__':
                sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
                sys.exit(
                    load_entry_point('spec', 'console_scripts', 'name')()
                )
            """)
        dist = FakeDist()

        args = next(ei.ScriptWriter.get_args(dist))
        name, script = itertools.islice(args, 2)

        assert script == expected
项目:browser_vuln_check    作者:lcatro    | 项目源码 | 文件源码
def test_get_script_args(self):
        header = ei.CommandSpec.best().from_environment().as_header()
        expected = header + DALS("""
            # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
            __requires__ = 'spec'
            import re
            import sys
            from pkg_resources import load_entry_point

            if __name__ == '__main__':
                sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
                sys.exit(
                    load_entry_point('spec', 'console_scripts', 'name')()
                )
            """)
        dist = FakeDist()

        args = next(ei.ScriptWriter.get_args(dist))
        name, script = itertools.islice(args, 2)

        assert script == expected
项目:facebook-face-recognition    作者:mathur    | 项目源码 | 文件源码
def test_get_script_args(self):
        header = ei.CommandSpec.best().from_environment().as_header()
        expected = header + DALS("""
            # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
            __requires__ = 'spec'
            import sys
            from pkg_resources import load_entry_point

            if __name__ == '__main__':
                sys.exit(
                    load_entry_point('spec', 'console_scripts', 'name')()
                )
            """)
        dist = FakeDist()

        args = next(ei.ScriptWriter.get_args(dist))
        name, script = itertools.islice(args, 2)

        assert script == expected
项目:MyFriend-Rob    作者:lcheniv    | 项目源码 | 文件源码
def test_get_script_args(self):
        header = ei.CommandSpec.best().from_environment().as_header()
        expected = header + DALS("""
            # EASY-INSTALL-ENTRY-SCRIPT: 'spec','console_scripts','name'
            __requires__ = 'spec'
            import sys
            from pkg_resources import load_entry_point

            if __name__ == '__main__':
                sys.exit(
                    load_entry_point('spec', 'console_scripts', 'name')()
                )
            """)
        dist = FakeDist()

        args = next(ei.ScriptWriter.get_args(dist))
        name, script = itertools.islice(args, 2)

        assert script == expected
项目:Sudoku-Solver    作者:ayush1997    | 项目源码 | 文件源码
def test_custom_launch_command(self):
        """
        Show how a custom CommandSpec could be used to specify a #! executable
        which takes parameters.
        """
        cmd = ei.CommandSpec(['/usr/bin/env', 'python3'])
        assert cmd.as_header() == '#!/usr/bin/env python3\n'
项目:Sudoku-Solver    作者:ayush1997    | 项目源码 | 文件源码
def test_from_param_for_CommandSpec_is_passthrough(self):
        """
        from_param should return an instance of a CommandSpec
        """
        cmd = ei.CommandSpec(['python'])
        cmd_new = ei.CommandSpec.from_param(cmd)
        assert cmd is cmd_new
项目:Sudoku-Solver    作者:ayush1997    | 项目源码 | 文件源码
def test_from_environment_with_spaces_in_executable(self):
        with mock.patch('sys.executable', TestScriptHeader.exe_with_spaces):
            cmd = ei.CommandSpec.from_environment()
        assert len(cmd) == 1
        assert cmd.as_header().startswith('#!"')
项目:Sudoku-Solver    作者:ayush1997    | 项目源码 | 文件源码
def test_from_simple_string_uses_shlex(self):
        """
        In order to support `executable = /usr/bin/env my-python`, make sure
        from_param invokes shlex on that input.
        """
        cmd = ei.CommandSpec.from_param('/usr/bin/env my-python')
        assert len(cmd) == 2
        assert '"' not in cmd.as_header()
项目:setuptools    作者:pypa    | 项目源码 | 文件源码
def test_custom_launch_command(self):
        """
        Show how a custom CommandSpec could be used to specify a #! executable
        which takes parameters.
        """
        cmd = ei.CommandSpec(['/usr/bin/env', 'python3'])
        assert cmd.as_header() == '#!/usr/bin/env python3\n'
项目:setuptools    作者:pypa    | 项目源码 | 文件源码
def test_from_param_for_CommandSpec_is_passthrough(self):
        """
        from_param should return an instance of a CommandSpec
        """
        cmd = ei.CommandSpec(['python'])
        cmd_new = ei.CommandSpec.from_param(cmd)
        assert cmd is cmd_new
项目:setuptools    作者:pypa    | 项目源码 | 文件源码
def test_from_environment_with_spaces_in_executable(self):
        os.environ.pop('__PYVENV_LAUNCHER__', None)
        cmd = ei.CommandSpec.from_environment()
        assert len(cmd) == 1
        assert cmd.as_header().startswith('#!"')
项目:setuptools    作者:pypa    | 项目源码 | 文件源码
def test_from_simple_string_uses_shlex(self):
        """
        In order to support `executable = /usr/bin/env my-python`, make sure
        from_param invokes shlex on that input.
        """
        cmd = ei.CommandSpec.from_param('/usr/bin/env my-python')
        assert len(cmd) == 2
        assert '"' not in cmd.as_header()
项目:browser_vuln_check    作者:lcatro    | 项目源码 | 文件源码
def test_custom_launch_command(self):
        """
        Show how a custom CommandSpec could be used to specify a #! executable
        which takes parameters.
        """
        cmd = ei.CommandSpec(['/usr/bin/env', 'python3'])
        assert cmd.as_header() == '#!/usr/bin/env python3\n'
项目:browser_vuln_check    作者:lcatro    | 项目源码 | 文件源码
def test_from_param_for_CommandSpec_is_passthrough(self):
        """
        from_param should return an instance of a CommandSpec
        """
        cmd = ei.CommandSpec(['python'])
        cmd_new = ei.CommandSpec.from_param(cmd)
        assert cmd is cmd_new
项目:browser_vuln_check    作者:lcatro    | 项目源码 | 文件源码
def test_from_environment_with_spaces_in_executable(self):
        os.environ.pop('__PYVENV_LAUNCHER__', None)
        cmd = ei.CommandSpec.from_environment()
        assert len(cmd) == 1
        assert cmd.as_header().startswith('#!"')
项目:browser_vuln_check    作者:lcatro    | 项目源码 | 文件源码
def test_from_simple_string_uses_shlex(self):
        """
        In order to support `executable = /usr/bin/env my-python`, make sure
        from_param invokes shlex on that input.
        """
        cmd = ei.CommandSpec.from_param('/usr/bin/env my-python')
        assert len(cmd) == 2
        assert '"' not in cmd.as_header()
项目:facebook-face-recognition    作者:mathur    | 项目源码 | 文件源码
def test_custom_launch_command(self):
        """
        Show how a custom CommandSpec could be used to specify a #! executable
        which takes parameters.
        """
        cmd = ei.CommandSpec(['/usr/bin/env', 'python3'])
        assert cmd.as_header() == '#!/usr/bin/env python3\n'
项目:facebook-face-recognition    作者:mathur    | 项目源码 | 文件源码
def test_from_param_for_CommandSpec_is_passthrough(self):
        """
        from_param should return an instance of a CommandSpec
        """
        cmd = ei.CommandSpec(['python'])
        cmd_new = ei.CommandSpec.from_param(cmd)
        assert cmd is cmd_new
项目:facebook-face-recognition    作者:mathur    | 项目源码 | 文件源码
def test_from_environment_with_spaces_in_executable(self):
        with mock.patch('sys.executable', TestScriptHeader.exe_with_spaces):
            cmd = ei.CommandSpec.from_environment()
        assert len(cmd) == 1
        assert cmd.as_header().startswith('#!"')
项目:facebook-face-recognition    作者:mathur    | 项目源码 | 文件源码
def test_from_simple_string_uses_shlex(self):
        """
        In order to support `executable = /usr/bin/env my-python`, make sure
        from_param invokes shlex on that input.
        """
        cmd = ei.CommandSpec.from_param('/usr/bin/env my-python')
        assert len(cmd) == 2
        assert '"' not in cmd.as_header()
项目:MyFriend-Rob    作者:lcheniv    | 项目源码 | 文件源码
def test_custom_launch_command(self):
        """
        Show how a custom CommandSpec could be used to specify a #! executable
        which takes parameters.
        """
        cmd = ei.CommandSpec(['/usr/bin/env', 'python3'])
        assert cmd.as_header() == '#!/usr/bin/env python3\n'
项目:MyFriend-Rob    作者:lcheniv    | 项目源码 | 文件源码
def test_from_param_for_CommandSpec_is_passthrough(self):
        """
        from_param should return an instance of a CommandSpec
        """
        cmd = ei.CommandSpec(['python'])
        cmd_new = ei.CommandSpec.from_param(cmd)
        assert cmd is cmd_new
项目:MyFriend-Rob    作者:lcheniv    | 项目源码 | 文件源码
def test_from_environment_with_spaces_in_executable(self):
        with mock.patch('sys.executable', TestScriptHeader.exe_with_spaces):
            cmd = ei.CommandSpec.from_environment()
        assert len(cmd) == 1
        assert cmd.as_header().startswith('#!"')
项目:MyFriend-Rob    作者:lcheniv    | 项目源码 | 文件源码
def test_from_simple_string_uses_shlex(self):
        """
        In order to support `executable = /usr/bin/env my-python`, make sure
        from_param invokes shlex on that input.
        """
        cmd = ei.CommandSpec.from_param('/usr/bin/env my-python')
        assert len(cmd) == 2
        assert '"' not in cmd.as_header()