|
@@ -3,7 +3,6 @@ from __future__ import annotations
|
|
import argparse
|
|
import argparse
|
|
from concurrent.futures import Future, ThreadPoolExecutor
|
|
from concurrent.futures import Future, ThreadPoolExecutor
|
|
from os.path import abspath
|
|
from os.path import abspath
|
|
-from shutil import copyfile
|
|
|
|
from subprocess import CalledProcessError, run
|
|
from subprocess import CalledProcessError, run
|
|
from typing import Sequence
|
|
from typing import Sequence
|
|
|
|
|
|
@@ -55,32 +54,11 @@ stderr:
|
|
def main(argv: Sequence[str] | None = None) -> int:
|
|
def main(argv: Sequence[str] | None = None) -> int:
|
|
parser = argparse.ArgumentParser()
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("repo", type=str, help="Repository name.")
|
|
parser.add_argument("repo", type=str, help="Repository name.")
|
|
- parser.add_argument(
|
|
|
|
- "outdir", nargs="?", default=None, help="Used only by check_frozen_requirements."
|
|
|
|
- )
|
|
|
|
args = parser.parse_args(argv)
|
|
args = parser.parse_args(argv)
|
|
repo = args.repo
|
|
repo = args.repo
|
|
- outdir = args.outdir
|
|
|
|
|
|
|
|
base_path = abspath(gitroot())
|
|
base_path = abspath(gitroot())
|
|
|
|
|
|
- if outdir is None:
|
|
|
|
- outdir = base_path
|
|
|
|
- else:
|
|
|
|
- # We rely on pip-compile's behavior when -o FILE is
|
|
|
|
- # already a lockfile, due to >= pins.
|
|
|
|
- # So if we have a different outdir (used by things like
|
|
|
|
- # tools.lint_requirements), we'll need to copy over existing
|
|
|
|
- # lockfiles.
|
|
|
|
- lockfiles = [
|
|
|
|
- "requirements-frozen.txt",
|
|
|
|
- "requirements-dev-frozen.txt",
|
|
|
|
- ]
|
|
|
|
- if repo == "sentry":
|
|
|
|
- lockfiles.append("requirements-dev-only-frozen.txt")
|
|
|
|
- for fn in lockfiles:
|
|
|
|
- copyfile(f"{base_path}/{fn}", f"{outdir}/{fn}")
|
|
|
|
-
|
|
|
|
base_cmd = (
|
|
base_cmd = (
|
|
"pip-compile",
|
|
"pip-compile",
|
|
"--no-header",
|
|
"--no-header",
|
|
@@ -100,7 +78,7 @@ def main(argv: Sequence[str] | None = None) -> int:
|
|
*base_cmd,
|
|
*base_cmd,
|
|
f"{base_path}/requirements-base.txt",
|
|
f"{base_path}/requirements-base.txt",
|
|
"-o",
|
|
"-o",
|
|
- f"{outdir}/requirements-frozen.txt",
|
|
|
|
|
|
+ f"{base_path}/requirements-frozen.txt",
|
|
),
|
|
),
|
|
)
|
|
)
|
|
)
|
|
)
|
|
@@ -112,7 +90,7 @@ def main(argv: Sequence[str] | None = None) -> int:
|
|
f"{base_path}/requirements-base.txt",
|
|
f"{base_path}/requirements-base.txt",
|
|
f"{base_path}/requirements-dev.txt",
|
|
f"{base_path}/requirements-dev.txt",
|
|
"-o",
|
|
"-o",
|
|
- f"{outdir}/requirements-dev-frozen.txt",
|
|
|
|
|
|
+ f"{base_path}/requirements-dev-frozen.txt",
|
|
),
|
|
),
|
|
)
|
|
)
|
|
)
|
|
)
|
|
@@ -126,7 +104,7 @@ def main(argv: Sequence[str] | None = None) -> int:
|
|
# This is downloaded with bin/bump-sentry.
|
|
# This is downloaded with bin/bump-sentry.
|
|
f"{base_path}/sentry-requirements-frozen.txt",
|
|
f"{base_path}/sentry-requirements-frozen.txt",
|
|
"-o",
|
|
"-o",
|
|
- f"{outdir}/requirements-frozen.txt",
|
|
|
|
|
|
+ f"{base_path}/requirements-frozen.txt",
|
|
),
|
|
),
|
|
)
|
|
)
|
|
)
|
|
)
|
|
@@ -140,7 +118,7 @@ def main(argv: Sequence[str] | None = None) -> int:
|
|
# This is downloaded with bin/bump-sentry.
|
|
# This is downloaded with bin/bump-sentry.
|
|
f"{base_path}/sentry-requirements-dev-frozen.txt",
|
|
f"{base_path}/sentry-requirements-dev-frozen.txt",
|
|
"-o",
|
|
"-o",
|
|
- f"{outdir}/requirements-dev-frozen.txt",
|
|
|
|
|
|
+ f"{base_path}/requirements-dev-frozen.txt",
|
|
),
|
|
),
|
|
)
|
|
)
|
|
)
|
|
)
|
|
@@ -155,7 +133,7 @@ def main(argv: Sequence[str] | None = None) -> int:
|
|
*base_cmd,
|
|
*base_cmd,
|
|
f"{base_path}/requirements-dev.txt",
|
|
f"{base_path}/requirements-dev.txt",
|
|
"-o",
|
|
"-o",
|
|
- f"{outdir}/requirements-dev-only-frozen.txt",
|
|
|
|
|
|
+ f"{base_path}/requirements-dev-only-frozen.txt",
|
|
),
|
|
),
|
|
)
|
|
)
|
|
)
|
|
)
|