Mercurial > hg-stable
changeset 51373:cf1bee12ecdb
import-checker: make stdlib path detection work in virtual environments
The previous logic tried to find the directory containing BaseHTTPServer, which
didn’t work as indended because it was only present on Python 2. Instead, the
argparse module is used now.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Fri, 02 Feb 2024 04:03:15 +0100 |
parents | 0d414fb8336f |
children | 617af10994fb |
files | contrib/import-checker.py |
diffstat | 1 files changed, 2 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/import-checker.py Fri Feb 02 03:39:37 2024 +0100 +++ b/contrib/import-checker.py Fri Feb 02 04:03:15 2024 +0100 @@ -11,10 +11,7 @@ # to work when run from a virtualenv. The modules were chosen empirically # so that the return value matches the return value without virtualenv. if True: # disable lexical sorting checks - try: - import BaseHTTPServer as basehttpserver - except ImportError: - basehttpserver = None + import argparse import zlib import testparseutil @@ -244,7 +241,7 @@ stdlib_prefixes = {sys.prefix, sys.exec_prefix} # We need to supplement the list of prefixes for the search to work # when run from within a virtualenv. - for mod in (basehttpserver, zlib): + for mod in (argparse, zlib): if mod is None: continue try: