diff --git a/contrib/packaging/packaging.py b/contrib/packaging/packaging.py --- a/contrib/packaging/packaging.py +++ b/contrib/packaging/packaging.py @@ -1,74 +1,74 @@ -#!/usr/bin/env python3 -# -# packaging.py - Mercurial packaging functionality -# -# Copyright 2019 Gregory Szorc -# -# This software may be used and distributed according to the terms of the -# GNU General Public License version 2 or any later version. - -import os -import pathlib -import subprocess -import sys -import venv - - -HERE = pathlib.Path(os.path.abspath(__file__)).parent -REQUIREMENTS_TXT = HERE / "requirements.txt" -SOURCE_DIR = HERE.parent.parent -VENV = SOURCE_DIR / "build" / "venv-packaging" - - -def bootstrap(): - venv_created = not VENV.exists() - - VENV.parent.mkdir(exist_ok=True) - - venv.create(VENV, with_pip=True) - - if os.name == "nt": - venv_bin = VENV / "Scripts" - pip = venv_bin / "pip.exe" - python = venv_bin / "python.exe" - else: - venv_bin = VENV / "bin" - pip = venv_bin / "pip" - python = venv_bin / "python" - - args = [ - str(pip), - "install", - "-r", - str(REQUIREMENTS_TXT), - "--disable-pip-version-check", - ] - - if not venv_created: - args.append("-q") - - subprocess.run(args, check=True) - - os.environ["HGPACKAGING_BOOTSTRAPPED"] = "1" - os.environ["PATH"] = "%s%s%s" % (venv_bin, os.pathsep, os.environ["PATH"]) - - subprocess.run([str(python), __file__] + sys.argv[1:], check=True) - - -def run(): - import hgpackaging.cli as cli - - # Need to strip off main Python executable. - cli.main() - - -if __name__ == "__main__": - try: - if "HGPACKAGING_BOOTSTRAPPED" not in os.environ: - bootstrap() - else: - run() - except subprocess.CalledProcessError as e: - sys.exit(e.returncode) - except KeyboardInterrupt: - sys.exit(1) +#!/usr/bin/env python3 +# +# packaging.py - Mercurial packaging functionality +# +# Copyright 2019 Gregory Szorc +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. + +import os +import pathlib +import subprocess +import sys +import venv + + +HERE = pathlib.Path(os.path.abspath(__file__)).parent +REQUIREMENTS_TXT = HERE / "requirements.txt" +SOURCE_DIR = HERE.parent.parent +VENV = SOURCE_DIR / "build" / "venv-packaging" + + +def bootstrap(): + venv_created = not VENV.exists() + + VENV.parent.mkdir(exist_ok=True) + + venv.create(VENV, with_pip=True) + + if os.name == "nt": + venv_bin = VENV / "Scripts" + pip = venv_bin / "pip.exe" + python = venv_bin / "python.exe" + else: + venv_bin = VENV / "bin" + pip = venv_bin / "pip" + python = venv_bin / "python" + + args = [ + str(pip), + "install", + "-r", + str(REQUIREMENTS_TXT), + "--disable-pip-version-check", + ] + + if not venv_created: + args.append("-q") + + subprocess.run(args, check=True) + + os.environ["HGPACKAGING_BOOTSTRAPPED"] = "1" + os.environ["PATH"] = "%s%s%s" % (venv_bin, os.pathsep, os.environ["PATH"]) + + subprocess.run([str(python), __file__] + sys.argv[1:], check=True) + + +def run(): + import hgpackaging.cli as cli + + # Need to strip off main Python executable. + cli.main() + + +if __name__ == "__main__": + try: + if "HGPACKAGING_BOOTSTRAPPED" not in os.environ: + bootstrap() + else: + run() + except subprocess.CalledProcessError as e: + sys.exit(e.returncode) + except KeyboardInterrupt: + sys.exit(1) diff --git a/contrib/packaging/requirements.txt b/contrib/packaging/requirements.txt --- a/contrib/packaging/requirements.txt +++ b/contrib/packaging/requirements.txt @@ -1,12 +1,12 @@ -# -# This file is autogenerated by pip-compile -# To update, run: -# -# pip-compile --generate-hashes --output-file=contrib/packaging/requirements.txt contrib/packaging/requirements.txt.in -# +# +# This file is autogenerated by pip-compile +# To update, run: +# +# pip-compile --generate-hashes --output-file=contrib/packaging/requirements.txt contrib/packaging/requirements.txt.in +# jinja2==2.10.3 \ --hash=sha256:74320bb91f31270f9551d46522e33af46a80c3d619f4a4bf42b3164d30b5911f \ - --hash=sha256:9fe95f19286cfefaa917656583d020be14e7859c6b0252588391e47db34527de + --hash=sha256:9fe95f19286cfefaa917656583d020be14e7859c6b0252588391e47db34527de markupsafe==1.1.1 \ --hash=sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473 \ --hash=sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161 \ @@ -36,4 +36,4 @@ --hash=sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f \ --hash=sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f \ --hash=sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7 \ - # via jinja2 + # via jinja2 diff --git a/contrib/packaging/requirements.txt.in b/contrib/packaging/requirements.txt.in --- a/contrib/packaging/requirements.txt.in +++ b/contrib/packaging/requirements.txt.in @@ -1 +1 @@ -jinja2 +jinja2 diff --git a/contrib/packaging/wix/requirements.txt.in b/contrib/packaging/wix/requirements.txt.in --- a/contrib/packaging/wix/requirements.txt.in +++ b/contrib/packaging/wix/requirements.txt.in @@ -1,2 +1,2 @@ -docutils -pygments +docutils +pygments