diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-01-18 12:45:42 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-01-18 15:07:55 -0500 |
commit | cd96ffe287e26651f8dce4f688bf87af1e423f06 (patch) | |
tree | 123197d983714caa9ae225d330fcf3743ba11b52 /lib/sqlalchemy/util/langhelpers.py | |
parent | f91a25cd8191f026dd43c0a2475cda8a56d65c19 (diff) | |
download | sqlalchemy-cd96ffe287e26651f8dce4f688bf87af1e423f06.tar.gz |
refactor code generation tools , include --check command
in particular it looks like CI was not picking up on the
"git diff" oriented commands, which were failing to run due
to pathing issues. As we were setting cwd for black/zimports
relative to sqlalchemy library, and tox installs it in
the venv, black/zimports would fail to run from tox, and
since these are subprocess.run we didn't pick up the
failure.
This overall locks down how zimports/black are run
so that we are definitely from the source root, by using
the location of tools/ to determine the root.
Fixes: #8892
Change-Id: I7c54b747edd5a80e0c699b8456febf66d8b62375
Diffstat (limited to 'lib/sqlalchemy/util/langhelpers.py')
-rw-r--r-- | lib/sqlalchemy/util/langhelpers.py | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py index 5058b7e78..767148045 100644 --- a/lib/sqlalchemy/util/langhelpers.py +++ b/lib/sqlalchemy/util/langhelpers.py @@ -19,7 +19,6 @@ import hashlib import inspect import itertools import operator -import os import re import sys import textwrap @@ -34,7 +33,6 @@ from typing import Generic from typing import Iterator from typing import List from typing import Mapping -from typing import no_type_check from typing import NoReturn from typing import Optional from typing import overload @@ -2180,45 +2178,3 @@ def has_compiled_ext(raise_=False): ) else: return False - - -@no_type_check -def console_scripts( - path: str, options: dict, ignore_output: bool = False -) -> None: - - import subprocess - import shlex - from pathlib import Path - - is_posix = os.name == "posix" - - entrypoint_name = options["entrypoint"] - - for entry in compat.importlib_metadata_get("console_scripts"): - if entry.name == entrypoint_name: - impl = entry - break - else: - raise Exception( - f"Could not find entrypoint console_scripts.{entrypoint_name}" - ) - cmdline_options_str = options.get("options", "") - cmdline_options_list = shlex.split(cmdline_options_str, posix=is_posix) + [ - path - ] - - kw = {} - if ignore_output: - kw["stdout"] = kw["stderr"] = subprocess.DEVNULL - - subprocess.run( - [ - sys.executable, - "-c", - "import %s; %s.%s()" % (impl.module, impl.module, impl.attr), - ] - + cmdline_options_list, - cwd=Path(__file__).parent.parent, - **kw, - ) |