I must have my editor on Windows configured incorrectly because
I submitted patches with Windows line endings :(
- skip-blame whitespace only line ending changes
( )
hg-reviewers |
I must have my editor on Windows configured incorrectly because
I submitted patches with Windows line endings :(
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | contrib/packaging/packaging.py (148 lines) | |||
M | contrib/packaging/requirements.txt (16 lines) | |||
M | contrib/packaging/requirements.txt.in (2 lines) | |||
M | contrib/packaging/wix/requirements.txt.in (4 lines) |
Status | Author | Revision | |
---|---|---|---|
Abandoned | indygreg | D7424 [RFC] pyoxidizer | |
Abandoned | indygreg | ||
Changes Planned | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | D7420 black: blacken scripts |
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# | # | ||||
# packaging.py - Mercurial packaging functionality | # packaging.py - Mercurial packaging functionality | ||||
# | # | ||||
# Copyright 2019 Gregory Szorc <gregory.szorc@gmail.com> | # Copyright 2019 Gregory Szorc <gregory.szorc@gmail.com> | ||||
# | # | ||||
# This software may be used and distributed according to the terms of the | # This software may be used and distributed according to the terms of the | ||||
# GNU General Public License version 2 or any later version. | # GNU General Public License version 2 or any later version. | ||||
import os | import os | ||||
import pathlib | import pathlib | ||||
import subprocess | import subprocess | ||||
import sys | import sys | ||||
import venv | import venv | ||||
HERE = pathlib.Path(os.path.abspath(__file__)).parent | HERE = pathlib.Path(os.path.abspath(__file__)).parent | ||||
REQUIREMENTS_TXT = HERE / "requirements.txt" | REQUIREMENTS_TXT = HERE / "requirements.txt" | ||||
SOURCE_DIR = HERE.parent.parent | SOURCE_DIR = HERE.parent.parent | ||||
VENV = SOURCE_DIR / "build" / "venv-packaging" | VENV = SOURCE_DIR / "build" / "venv-packaging" | ||||
def bootstrap(): | def bootstrap(): | ||||
venv_created = not VENV.exists() | venv_created = not VENV.exists() | ||||
VENV.parent.mkdir(exist_ok=True) | VENV.parent.mkdir(exist_ok=True) | ||||
venv.create(VENV, with_pip=True) | venv.create(VENV, with_pip=True) | ||||
if os.name == "nt": | if os.name == "nt": | ||||
venv_bin = VENV / "Scripts" | venv_bin = VENV / "Scripts" | ||||
pip = venv_bin / "pip.exe" | pip = venv_bin / "pip.exe" | ||||
python = venv_bin / "python.exe" | python = venv_bin / "python.exe" | ||||
else: | else: | ||||
venv_bin = VENV / "bin" | venv_bin = VENV / "bin" | ||||
pip = venv_bin / "pip" | pip = venv_bin / "pip" | ||||
python = venv_bin / "python" | python = venv_bin / "python" | ||||
args = [ | args = [ | ||||
str(pip), | str(pip), | ||||
"install", | "install", | ||||
"-r", | "-r", | ||||
str(REQUIREMENTS_TXT), | str(REQUIREMENTS_TXT), | ||||
"--disable-pip-version-check", | "--disable-pip-version-check", | ||||
] | ] | ||||
if not venv_created: | if not venv_created: | ||||
args.append("-q") | args.append("-q") | ||||
subprocess.run(args, check=True) | subprocess.run(args, check=True) | ||||
os.environ["HGPACKAGING_BOOTSTRAPPED"] = "1" | os.environ["HGPACKAGING_BOOTSTRAPPED"] = "1" | ||||
os.environ["PATH"] = "%s%s%s" % (venv_bin, os.pathsep, os.environ["PATH"]) | os.environ["PATH"] = "%s%s%s" % (venv_bin, os.pathsep, os.environ["PATH"]) | ||||
subprocess.run([str(python), __file__] + sys.argv[1:], check=True) | subprocess.run([str(python), __file__] + sys.argv[1:], check=True) | ||||
def run(): | def run(): | ||||
import hgpackaging.cli as cli | import hgpackaging.cli as cli | ||||
# Need to strip off main Python executable. | # Need to strip off main Python executable. | ||||
cli.main() | cli.main() | ||||
if __name__ == "__main__": | if __name__ == "__main__": | ||||
try: | try: | ||||
if "HGPACKAGING_BOOTSTRAPPED" not in os.environ: | if "HGPACKAGING_BOOTSTRAPPED" not in os.environ: | ||||
bootstrap() | bootstrap() | ||||
else: | else: | ||||
run() | run() | ||||
except subprocess.CalledProcessError as e: | except subprocess.CalledProcessError as e: | ||||
sys.exit(e.returncode) | sys.exit(e.returncode) | ||||
except KeyboardInterrupt: | except KeyboardInterrupt: | ||||
sys.exit(1) | sys.exit(1) |
# | # | ||||
# This file is autogenerated by pip-compile | # This file is autogenerated by pip-compile | ||||
# To update, run: | # To update, run: | ||||
# | # | ||||
# pip-compile --generate-hashes --output-file=contrib/packaging/requirements.txt contrib/packaging/requirements.txt.in | # pip-compile --generate-hashes --output-file=contrib/packaging/requirements.txt contrib/packaging/requirements.txt.in | ||||
# | # | ||||
jinja2==2.10.3 \ | jinja2==2.10.3 \ | ||||
--hash=sha256:74320bb91f31270f9551d46522e33af46a80c3d619f4a4bf42b3164d30b5911f \ | --hash=sha256:74320bb91f31270f9551d46522e33af46a80c3d619f4a4bf42b3164d30b5911f \ | ||||
--hash=sha256:9fe95f19286cfefaa917656583d020be14e7859c6b0252588391e47db34527de | --hash=sha256:9fe95f19286cfefaa917656583d020be14e7859c6b0252588391e47db34527de | ||||
markupsafe==1.1.1 \ | markupsafe==1.1.1 \ | ||||
--hash=sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473 \ | --hash=sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473 \ | ||||
--hash=sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161 \ | --hash=sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161 \ | ||||
--hash=sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235 \ | --hash=sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235 \ | ||||
--hash=sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5 \ | --hash=sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5 \ | ||||
--hash=sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff \ | --hash=sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff \ | ||||
--hash=sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b \ | --hash=sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b \ | ||||
--hash=sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1 \ | --hash=sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1 \ | ||||
--hash=sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21 \ | --hash=sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21 \ | ||||
--hash=sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2 \ | --hash=sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2 \ | ||||
--hash=sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5 \ | --hash=sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5 \ | ||||
--hash=sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b \ | --hash=sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b \ | ||||
--hash=sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6 \ | --hash=sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6 \ | ||||
--hash=sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f \ | --hash=sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f \ | ||||
--hash=sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f \ | --hash=sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f \ | ||||
--hash=sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7 \ | --hash=sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7 \ | ||||
# via jinja2 | # via jinja2 |