Eryk Sun <eryk...@gmail.com> added the comment:

The code to copy a file could be rewritten to use a regex match. For example:

            # Copy src to dst. If src is a base executable, copy a launcher.
            dirname, filename = os.path.split(src)
            m = re.match(r'(pythonw?)[0-9._]*((?:_d)?(?:\.exe|\.pdb))$',
                    filename.lower())
            if m is not None:
                src = os.path.join(os.path.dirname(__file__),
                        'scripts', 'nt', m.group(1) + m.group(2))
                # If the base environment is a Python source build, use
                # the launcher in the build directory instead of
                # "Lib/venv/scripts/nt".
                if sysconfig.is_python_build(True) or not os.path.isfile(src):
                    basename = ('venvlauncher' if m.group(1) == 'python' else
                                'venvwlauncher')
                    src = os.path.join(dirname, basename + m.group(2))

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43749>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to