This needs lots of work. Posting so @mharbison and others can see what
I've been hacking on.
To build:
$ cd rust/hgcli $ pyoxidizer build
Things currently blow up in many different ways at run time.
hg-reviewers |
This needs lots of work. Posting so @mharbison and others can see what
I've been hacking on.
To build:
$ cd rust/hgcli $ pyoxidizer build
Things currently blow up in many different ways at run time.
No Linters Available |
No Unit Test Coverage |
This is in no way suitable for review or landing. Many things are missing. Binaries segfault on startup (which is likely a PyOxidizer bug, ugh).
Path | Packages | |||
---|---|---|---|---|
A | M | contrib/packaging/hgpackaging/pyoxidizer.py (70 lines) | ||
A | M | rust/hgcli/Cargo.lock (336 lines) | ||
A | M | rust/hgcli/Cargo.toml (14 lines) | ||
A | M | rust/hgcli/pyoxidizer.toml (75 lines) | ||
A | M | rust/hgcli/src/main.rs (37 lines) | ||
M | setup.py (6 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
900eb7489260 | c08520b80b9c | Gregory Szorc | Oct 31 2019, 10:15 PM |
Status | Author | Revision | |
---|---|---|---|
Abandoned | indygreg | D7424 [RFC] pyoxidizer | |
Abandoned | indygreg | ||
Changes Planned | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | D7420 black: blacken scripts |
# pyoxidizer.py - Functionality for packaging using PyOxidizer. | |||||
# | |||||
# Copyright 2019 Gregory Szorc <gregory.szorc@gmail.com> | |||||
# | |||||
# 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 shutil | |||||
import subprocess | |||||
def build_pyoxidizer( | |||||
source_dir: pathlib.Path, | |||||
build_dir: pathlib.Path, | |||||
pyoxidizer_bin: pathlib.Path = 'pyoxidizer', | |||||
): | |||||
"""Build Mercurial using PyOxidizer. | |||||
The resulting files will be copied to ``build_dir``. | |||||
""" | |||||
config_path = source_dir / 'rust' / 'hgcli' | |||||
staging_dir = build_dir / 'staging' | |||||
if staging_dir.exists(): | |||||
shutil.rmtree(staging_dir) | |||||
res = subprocess.run( | |||||
[str(pyoxidizer_bin), 'app-path', '--release', str(config_path)], | |||||
check=True, | |||||
capture_output=True, | |||||
) | |||||
app_path = pathlib.Path(res.stdout.strip()) | |||||
subprocess.run( | |||||
[str(pyoxidizer_bin), 'build', '--release', str(config_path)], | |||||
check=True, | |||||
) | |||||
# PyOxidizer's application staging doesn't currently handle resource | |||||
# files properly. So we need to massage the file layout so things work. | |||||
staging_dir.mkdir(parents=True) | |||||
# All files in the root directory are fine. | |||||
for p in os.listdir(app_path): | |||||
p = app_path / p | |||||
if p.is_file(): | |||||
dest = staging_dir / p.name | |||||
shutil.copyfile(p, dest) | |||||
# For the lib directory, only copy .py and .pyc files: we'll manage | |||||
# the resource files ourselves later. | |||||
for root, dirs, files in os.walk(app_path / 'lib'): | |||||
dirs.sort() | |||||
rel_dir = (app_path / 'lib').relative_to(app_path) | |||||
for f in sorted(files): | |||||
if not f.endswith(('.py', '.pyc')): | |||||
continue | |||||
dest_dir = staging_dir / rel_dir | |||||
dest_dir.mkdir(parents=True, exist_ok=True) | |||||
dest = dest_dir / f | |||||
shutil.copyfile(root / f, dest) |
# This file is automatically @generated by Cargo. | |||||
# It is not intended for manual editing. | |||||
[[package]] | |||||
name = "aho-corasick" | |||||
version = "0.7.6" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "autocfg" | |||||
version = "0.1.7" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
[[package]] | |||||
name = "bitflags" | |||||
version = "1.2.1" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
[[package]] | |||||
name = "byteorder" | |||||
version = "1.3.2" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
[[package]] | |||||
name = "cc" | |||||
version = "1.0.46" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
[[package]] | |||||
name = "cfg-if" | |||||
version = "0.1.10" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
[[package]] | |||||
name = "cloudabi" | |||||
version = "0.0.3" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "cpython" | |||||
version = "0.2.1" | |||||
source = "git+https://github.com/indygreg/PyOxidizer.git?tag=v0.3.0#ae305ea8f3aecb6ce558cb0118fd83a4e20c1e81" | |||||
dependencies = [ | |||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"python3-sys 0.2.1 (git+https://github.com/indygreg/PyOxidizer.git?tag=v0.3.0)", | |||||
] | |||||
[[package]] | |||||
name = "fs_extra" | |||||
version = "1.1.0" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
[[package]] | |||||
name = "fuchsia-cprng" | |||||
version = "0.1.1" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
[[package]] | |||||
name = "hg" | |||||
version = "0.1.0" | |||||
dependencies = [ | |||||
"jemallocator-global 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"pyembed 0.3.0", | |||||
] | |||||
[[package]] | |||||
name = "jemalloc-sys" | |||||
version = "0.3.2" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "jemallocator" | |||||
version = "0.3.2" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"jemalloc-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "jemallocator-global" | |||||
version = "0.3.2" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "lazy_static" | |||||
version = "1.4.0" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
[[package]] | |||||
name = "libc" | |||||
version = "0.2.65" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
[[package]] | |||||
name = "memchr" | |||||
version = "2.2.1" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
[[package]] | |||||
name = "num-traits" | |||||
version = "0.2.8" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "pyembed" | |||||
version = "0.3.0" | |||||
dependencies = [ | |||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"cpython 0.2.1 (git+https://github.com/indygreg/PyOxidizer.git?tag=v0.3.0)", | |||||
"jemalloc-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"python3-sys 0.2.1 (git+https://github.com/indygreg/PyOxidizer.git?tag=v0.3.0)", | |||||
"uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "python3-sys" | |||||
version = "0.2.1" | |||||
source = "git+https://github.com/indygreg/PyOxidizer.git?tag=v0.3.0#ae305ea8f3aecb6ce558cb0118fd83a4e20c1e81" | |||||
dependencies = [ | |||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "rand" | |||||
version = "0.6.5" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "rand_chacha" | |||||
version = "0.1.1" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "rand_core" | |||||
version = "0.3.1" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "rand_core" | |||||
version = "0.4.2" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
[[package]] | |||||
name = "rand_hc" | |||||
version = "0.1.0" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "rand_isaac" | |||||
version = "0.1.1" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "rand_jitter" | |||||
version = "0.1.4" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "rand_os" | |||||
version = "0.1.3" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "rand_pcg" | |||||
version = "0.1.2" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "rand_xorshift" | |||||
version = "0.1.1" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "rdrand" | |||||
version = "0.4.0" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "regex" | |||||
version = "1.3.1" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "regex-syntax" | |||||
version = "0.6.12" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
[[package]] | |||||
name = "thread_local" | |||||
version = "0.3.6" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "uuid" | |||||
version = "0.7.4" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "winapi" | |||||
version = "0.3.8" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "winapi-i686-pc-windows-gnu" | |||||
version = "0.4.0" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
[[package]] | |||||
name = "winapi-x86_64-pc-windows-gnu" | |||||
version = "0.4.0" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
[metadata] | |||||
"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" | |||||
"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" | |||||
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" | |||||
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" | |||||
"checksum cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "0213d356d3c4ea2c18c40b037c3be23cd639825c18f25ee670ac7813beeef99c" | |||||
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" | |||||
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" | |||||
"checksum cpython 0.2.1 (git+https://github.com/indygreg/PyOxidizer.git?tag=v0.3.0)" = "<none>" | |||||
"checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" | |||||
"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" | |||||
"checksum jemalloc-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45" | |||||
"checksum jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69" | |||||
"checksum jemallocator-global 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "991b61de8365c8b5707cf6cabbff98cfd6eaca9b851948b883efea408c7f581e" | |||||
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" | |||||
"checksum libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8" | |||||
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" | |||||
"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" | |||||
"checksum python3-sys 0.2.1 (git+https://github.com/indygreg/PyOxidizer.git?tag=v0.3.0)" = "<none>" | |||||
"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" | |||||
"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" | |||||
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" | |||||
"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" | |||||
"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" | |||||
"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" | |||||
"checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" | |||||
"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" | |||||
"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" | |||||
"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" | |||||
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" | |||||
"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd" | |||||
"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716" | |||||
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" | |||||
"checksum uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a" | |||||
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" | |||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" | |||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" |
[package] | |||||
name = "hg" | |||||
version = "0.1.0" | |||||
authors = ["Gregory Szorc <gregory.szorc@gmail.com>"] | |||||
license = "GPL-2.0" | |||||
edition = "2018" | |||||
[dependencies] | |||||
jemallocator-global = { version = "0.3", optional = true } | |||||
pyembed = { path = "../pyembed" } | |||||
[features] | |||||
default = [] | |||||
jemalloc = ["jemallocator-global", "pyembed/jemalloc"] |
# This file controls the PyOxidizer build configuration. See the | |||||
# pyoxidizer crate's documentation for extensive documentation | |||||
# on this file format. | |||||
[[build]] | |||||
application_name = "hg" | |||||
build_path = "$ORIGIN/../../build/pyoxidizer" | |||||
[[embedded_python_config]] | |||||
raw_allocator = "jemalloc" | |||||
# Windows doesn't support jemalloc. | |||||
[[embedded_python_config]] | |||||
build_target = "i686-pc-windows-msvc" | |||||
raw_allocator = "system" | |||||
[[embedded_python_config]] | |||||
build_target = "x86_64-pc-windows-msvc" | |||||
raw_allocator = "system" | |||||
# Mercurial requires a fully featured Python because extensions may use | |||||
# anything. | |||||
[[packaging_rule]] | |||||
type = "stdlib-extensions-policy" | |||||
policy = "all" | |||||
[[packaging_rule]] | |||||
type = "stdlib" | |||||
include_source = true | |||||
[[packaging_rule]] | |||||
type = "setup-py-install" | |||||
package_path = "../.." | |||||
extra_global_arguments = ["clean", "--all", "build"] | |||||
# Our code doesn't yet work with the in-memory importer. So package | |||||
# relative to the executable for now. | |||||
install_location = "app-relative:lib" | |||||
[[embedded_python_config]] | |||||
sys_paths = ["$ORIGIN/lib"] | |||||
[[embedded_python_run]] | |||||
mode = "eval" | |||||
code = "import hgdemandimport; hgdemandimport.enable(); import mercurial.dispatch; mercurial.dispatch.run()" | |||||
# END OF COMMON USER-ADJUSTED SETTINGS. | |||||
# | |||||
# Everything below this is typically managed by PyOxidizer and doesn't need | |||||
# to be updated by people. | |||||
[[python_distribution]] | |||||
build_target = "i686-pc-windows-msvc" | |||||
url = "https://github.com/indygreg/python-build-standalone/releases/download/20191025/cpython-3.7.5-windows-x86-20191025T0549.tar.zst" | |||||
sha256 = "388d37bcffee183bc23f5fec9c263779c59d298d35c9e4445b407d95f94db19c" | |||||
[[python_distribution]] | |||||
build_target = "x86_64-apple-darwin" | |||||
url = "https://github.com/indygreg/python-build-standalone/releases/download/20191025/cpython-3.7.5-macos-20191026T0535.tar.zst" | |||||
sha256 = "e8d0710627c017213d9c5c6496577539a5adceb56d3060e07954ce9bf59f39ae" | |||||
[[python_distribution]] | |||||
build_target = "x86_64-pc-windows-msvc" | |||||
url = "https://github.com/indygreg/python-build-standalone/releases/download/20191025/cpython-3.7.5-windows-amd64-20191025T0540.tar.zst" | |||||
sha256 = "86a3260edabeed314c6f32a931e60dd097fa854b1346561443353e1bc90e3edd" | |||||
[[python_distribution]] | |||||
build_target = "x86_64-unknown-linux-gnu" | |||||
url = "https://github.com/indygreg/python-build-standalone/releases/download/20191025/cpython-3.7.5-linux64-20191025T0506.tar.zst" | |||||
sha256 = "608871543e6d2cb80e958638e31158355c578c114e12c77765ea5fb996a5a2c2" | |||||
[[python_distribution]] | |||||
build_target = "x86_64-unknown-linux-musl" | |||||
url = "https://github.com/indygreg/python-build-standalone/releases/download/20191025/cpython-3.7.5-linux64-musl-20191026T0603.tar.zst" | |||||
sha256 = "9d46c1964e32f77f22fec96c8acb905e8d4ff54594ca9a2660467f974dca3a53" | |||||
[[pyoxidizer]] | |||||
version = "0.4.0" | |||||
commit = "b489cfb8c575d26469a0a70b255c70264a06b00a" |
// main.rs -- Main routines for `hg` program | |||||
// | |||||
// Copyright 2019 Gregory Szorc <gregory.szorc@gmail.com> | |||||
// | |||||
// This software may be used and distributed according to the terms of the | |||||
// GNU General Public License version 2 or any later version. | |||||
use pyembed::{default_python_config, MainPythonInterpreter}; | |||||
fn main() { | |||||
// The following code is in a block so the MainPythonInterpreter is destroyed in an | |||||
// orderly manner, before process exit. | |||||
let code = { | |||||
// Load the default Python configuration as derived by the PyOxidizer config | |||||
// file used at build time. | |||||
let config = default_python_config(); | |||||
// Construct a new Python interpreter using that config, handling any errors | |||||
// from construction. | |||||
match MainPythonInterpreter::new(config) { | |||||
Ok(mut interp) => { | |||||
// And run it using the default run configuration as specified by the | |||||
// configuration. If an uncaught Python exception is raised, handle it. | |||||
// This includes the special SystemExit, which is a request to terminate the | |||||
// process. | |||||
interp.run_as_main() | |||||
} | |||||
Err(msg) => { | |||||
eprintln!("{}", msg); | |||||
1 | |||||
} | |||||
} | |||||
}; | |||||
// And exit the process according to code execution results. | |||||
std::process::exit(code); | |||||
} |
raise | raise | ||||
log.warn( | log.warn( | ||||
"Failed to build optional extension '%s' (skipping)", ext.name | "Failed to build optional extension '%s' (skipping)", ext.name | ||||
) | ) | ||||
class hgbuildscripts(build_scripts): | class hgbuildscripts(build_scripts): | ||||
def run(self): | def run(self): | ||||
if os.name != 'nt' or self.distribution.pure: | if ( | ||||
os.name != 'nt' | |||||
or self.distribution.pure | |||||
or 'PYOXIDIZER' in os.environ | |||||
): | |||||
return build_scripts.run(self) | return build_scripts.run(self) | ||||
exebuilt = False | exebuilt = False | ||||
try: | try: | ||||
self.run_command('build_hgexe') | self.run_command('build_hgexe') | ||||
exebuilt = True | exebuilt = True | ||||
except (DistutilsError, CCompilerError): | except (DistutilsError, CCompilerError): | ||||
log.warn('failed to build optional hg.exe') | log.warn('failed to build optional hg.exe') |