Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • mercurial/mercurial-devel
1 result
Show changes
Commits on Source (745)
Showing
with 276 additions and 344 deletions
[flake8]
max-line-length = 80
......@@ -19,6 +19,7 @@
*.zip
\#*\#
.\#*
.venv*
result/
tests/artifacts/cache/big-file-churn.hg
tests/.coverage*
......@@ -51,8 +52,6 @@
doc/build
doc/html
doc/man
MANIFEST
MANIFEST.in
patches
mercurial/__modulepolicy__.py
mercurial/__version__.py
......
......@@ -271,3 +271,4 @@
b267c5764cc6b804c619a42067405f27e8705beb 0 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
......@@ -287,3 +287,4 @@
b267c5764cc6b804c619a42067405f27e8705beb 6.9
9751b9ccd74d8386687f88fbdfe280877840ec7d 6.9.1
b964f92261d4fbb64f19aa6af2b072f7730b913a 6.9.2
ed68f9a47a090cc6450a7d5617baf123ba5fc42a 7.0rc0
# Mercurial's Contributing guidelines
Our full contribution guidelines are in our wiki, please see:
......@@ -1,6 +3,6 @@
Our full contribution guidelines are in our wiki, please see:
https://www.mercurial-scm.org/wiki/ContributingChanges
<https://www.mercurial-scm.org/wiki/ContributingChanges>
If you just want a checklist to follow, you can go straight to
......@@ -4,10 +6,10 @@
If you just want a checklist to follow, you can go straight to
https://www.mercurial-scm.org/wiki/ContributingChanges#Submission_checklist
<https://www.mercurial-scm.org/wiki/ContributingChanges#Submission_checklist>
If you can't run the entire testsuite for some reason (it can be
difficult on Windows), please at least run `contrib/check-code.py` on
any files you've modified and run `python contrib/check-commit` on any
commits you've made (for example, `python contrib/check-commit
273ce12ad8f1` will report some style violations on a very old commit).
......@@ -8,6 +10,36 @@
If you can't run the entire testsuite for some reason (it can be
difficult on Windows), please at least run `contrib/check-code.py` on
any files you've modified and run `python contrib/check-commit` on any
commits you've made (for example, `python contrib/check-commit
273ce12ad8f1` will report some style violations on a very old commit).
## Development dependencies
### Required dependencies
- Python (see `project.requires-python` in `pyproject.toml`) with `venv` and `pip`
- `make` with few other standard Unix tools (`diff`, `grep`, `unzip`, `gunzip`, `bunzip2` and `sed`)
For Windows, see `contrib/install-windows-dependencies.ps1`.
### Optional dependencies
- Mercurial contributors should install a quite recent Mercurial with the
extensions `evolve` and `topic` activated.
- A C compiler and Python headers (typically Debian package `python3-dev`
or Microsoft Build Tools for Visual Studio on Windows)
- `msgfmt` from the Debian package `gettext` (used to build the translations)
- [Rust tools](https://www.rust-lang.org/tools/install) (see `rust/README.rst`)
#### Note on installation
Mercurial is a Python application that can be installed with
[pipx](https://pipx.pypa.io) and `uv tool`. UV is a Rust application that can also be
installed with pipx or with
[its own installer](https://docs.astral.sh/uv/getting-started/installation/).
include mercurial/__version__.py
include doc/*.html
include doc/*.1 doc/*.5 doc/*.8
include doc/html/*.html
include doc/man/*.1
......@@ -20,9 +20,12 @@
$(eval HGROOT := $(shell pwd))
HGPYTHONS ?= $(HGROOT)/build/pythons
PURE=
PIP_OPTIONS_PURE=--config-settings --global-option="$(PURE)"
PIP_OPTIONS_INSTALL=--no-deps --ignore-installed --no-build-isolation
PIP_PREFIX=$(PREFIX)
PYFILESCMD=find mercurial hgext doc -name '*.py'
PYFILES:=$(shell $(PYFILESCMD))
DOCFILES=mercurial/helptext/*.txt
export LANGUAGE=C
export LC_ALL=C
TESTFLAGS ?= $(shell echo $$HGTESTFLAGS)
......@@ -23,9 +26,8 @@
PYFILESCMD=find mercurial hgext doc -name '*.py'
PYFILES:=$(shell $(PYFILESCMD))
DOCFILES=mercurial/helptext/*.txt
export LANGUAGE=C
export LC_ALL=C
TESTFLAGS ?= $(shell echo $$HGTESTFLAGS)
OSXVERSIONFLAGS ?= $(shell echo $$OSXVERSIONFLAGS)
CARGO = cargo
......@@ -30,5 +32,5 @@
CARGO = cargo
# Set this to e.g. "mingw32" to use a non-default compiler.
COMPILER=
VENV_NAME=$(shell $(PYTHON) -c "import sys; v = sys.version_info; print(f'.venv_{sys.implementation.name}{v.major}.{v.minor}')")
PYBINDIRNAME=$(shell $(PYTHON) -c "import os; print('Scripts' if os.name == 'nt' else 'bin')")
......@@ -34,7 +36,4 @@
COMPILERFLAG_tmp_ =
COMPILERFLAG_tmp_${COMPILER} ?= -c $(COMPILER)
COMPILERFLAG=${COMPILERFLAG_tmp_${COMPILER}}
.PHONY: help
help:
@echo 'Commonly used make targets:'
......@@ -39,4 +38,3 @@
help:
@echo 'Commonly used make targets:'
@echo ' all - build program and documentation'
@echo ' install - install program and man pages to $$PREFIX ($(PREFIX))'
......@@ -42,5 +40,5 @@
@echo ' install - install program and man pages to $$PREFIX ($(PREFIX))'
@echo ' install-home - install with setup.py install --home=$$HOME ($(HOME))'
@echo ' install-home - install with pip install --user'
@echo ' local - build for inplace usage'
@echo ' tests - run all tests in the automatic test suite'
@echo ' test-foo - run only specified tests (e.g. test-merge1.t)'
......@@ -49,4 +47,10 @@
@echo ' (except installed files or dist source tarball)'
@echo ' update-pot - update i18n/hg.pot'
@echo
@echo 'See CONTRIBUTING.md for the build and development dependencies.'
@echo
@echo 'Example for a system-wide installation under /usr/local for'
@echo 'downstream packaging (build and runtime deps have to be installed by hand)'
@echo ' su -c "make install" && hg version'
@echo
@echo 'Example for a system-wide installation under /usr/local:'
......@@ -52,6 +56,11 @@
@echo 'Example for a system-wide installation under /usr/local:'
@echo ' make all && su -c "make install" && hg version'
@echo ' make doc'
@echo ' su -c "make install PIP_OPTIONS_INSTALL=" && hg version'
@echo
@echo 'On some Linux distributions, you might need to specify both'
@echo 'PREFIX and PIP_PREFIX (here to install everything in /data/local)'
@echo ' make install PREFIX=/data/local PIP_PREFIX=/data PIP_OPTIONS_INSTALL='
@echo
@echo 'Example for a local installation (usable in this directory):'
@echo ' make local && ./hg version'
......@@ -54,7 +63,6 @@
@echo
@echo 'Example for a local installation (usable in this directory):'
@echo ' make local && ./hg version'
all: build doc
.PHONY: local
local:
......@@ -60,8 +68,6 @@
local:
MERCURIAL_SETUP_MAKE_LOCAL=1 $(PYTHON) setup.py $(PURE) \
build_py -c -d . \
build_ext $(COMPILERFLAG) -i \
build_hgexe $(COMPILERFLAG) -i \
build_mo
env HGRCPATH= $(PYTHON) hg version
$(PYTHON) -m venv $(VENV_NAME) --clear --upgrade-deps
$(VENV_NAME)/$(PYBINDIRNAME)/python -m \
pip install -e . -v $(PIP_OPTIONS_PURE)
env HGRCPATH= $(VENV_NAME)/$(PYBINDIRNAME)/hg version
......@@ -67,7 +73,5 @@
build:
$(PYTHON) setup.py $(PURE) build $(COMPILERFLAG)
.PHONY: build-chg
build-chg:
make -C contrib/chg
......@@ -71,6 +75,7 @@
build-chg:
make -C contrib/chg
.PHONY: build-rhg
build-rhg:
(cd rust/rhg; cargo build --release)
......@@ -74,4 +79,5 @@
build-rhg:
(cd rust/rhg; cargo build --release)
.PHONY: wheel
wheel:
......@@ -77,6 +83,6 @@
wheel:
FORCE_SETUPTOOLS=1 $(PYTHON) setup.py $(PURE) bdist_wheel $(COMPILERFLAG)
$(PYTHON) -m build --config-setting=--global-option="$(PURE)"
.PHONY: doc
doc:
$(MAKE) -C doc
......@@ -80,5 +86,6 @@
doc:
$(MAKE) -C doc
.PHONY: cleanbutpackages
cleanbutpackages:
rm -f hg.exe
......@@ -83,5 +90,5 @@
cleanbutpackages:
rm -f hg.exe
-$(PYTHON) setup.py clean --all # ignore errors from this command
rm -rf mercurial.egg-info dist
find contrib doc hgext hgext3rd i18n mercurial tests hgdemandimport \
\( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
......@@ -86,6 +93,7 @@
find contrib doc hgext hgext3rd i18n mercurial tests hgdemandimport \
\( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
rm -f MANIFEST MANIFEST.in hgext/__index__.py tests/*.err
rm -rf .venv_*
rm -f hgext/__index__.py tests/*.err
rm -f mercurial/__modulepolicy__.py
if test -d .hg; then rm -f mercurial/__version__.py; fi
rm -rf build mercurial/locale
......@@ -94,6 +102,7 @@
rm -rf rust/target
rm -f mercurial/rustext.so
.PHONY: clean
clean: cleanbutpackages
rm -rf packages
......@@ -97,5 +106,6 @@
clean: cleanbutpackages
rm -rf packages
.PHONY: install
install: install-bin install-doc
......@@ -100,5 +110,6 @@
install: install-bin install-doc
install-bin: build
$(PYTHON) setup.py $(PURE) install --root="$(DESTDIR)/" --prefix="$(PREFIX)" --force
.PHONY: install-bin
install-bin:
$(PYTHON) -m pip install . --prefix="$(PIP_PREFIX)" --force -v $(PIP_OPTIONS_PURE) $(PIP_OPTIONS_INSTALL)
......@@ -104,4 +115,5 @@
.PHONY: install-chg
install-chg: build-chg
make -C contrib/chg install PREFIX="$(PREFIX)"
......@@ -105,6 +117,7 @@
install-chg: build-chg
make -C contrib/chg install PREFIX="$(PREFIX)"
install-doc: doc
cd doc && $(MAKE) $(MFLAGS) install
.PHONY: install-doc
install-doc:
$(MAKE) -C doc $(MFLAGS) PREFIX="$(PREFIX)" install
......@@ -110,3 +123,4 @@
.PHONY: install-home
install-home: install-home-bin install-home-doc
......@@ -111,5 +125,6 @@
install-home: install-home-bin install-home-doc
install-home-bin: build
$(PYTHON) setup.py $(PURE) install --home="$(HOME)" --prefix="" --force
.PHONY: install-home-bin
install-home-bin:
$(PYTHON) -m pip install . --user --force -v $(PIP_OPTIONS_PURE) $(PIP_OPTIONS_INSTALL)
......@@ -115,4 +130,5 @@
install-home-doc: doc
cd doc && $(MAKE) $(MFLAGS) PREFIX="$(HOME)" install
.PHONY: install-home-doc
install-home-doc:
$(MAKE) -C doc $(MFLAGS) PREFIX="$(HOME)" install
......@@ -118,4 +134,5 @@
.PHONY: install-rhg
install-rhg: build-rhg
install -m 755 rust/target/release/rhg "$(PREFIX)"/bin/
......@@ -119,6 +136,6 @@
install-rhg: build-rhg
install -m 755 rust/target/release/rhg "$(PREFIX)"/bin/
MANIFEST-doc:
$(MAKE) -C doc MANIFEST
.PHONY: dist
dist: tests dist-notests
......@@ -124,6 +141,5 @@
MANIFEST.in: MANIFEST-doc
hg manifest | sed -e 's/^/include /' > MANIFEST.in
echo include mercurial/__version__.py >> MANIFEST.in
sed -e 's/^/include /' < doc/MANIFEST >> MANIFEST.in
.PHONY: dist-notests
dist-notests: doc
TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) -m build --sdist
......@@ -129,8 +145,4 @@
dist: tests dist-notests
dist-notests: doc MANIFEST.in
TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist
.PHONY: check
check: tests
......@@ -135,3 +147,4 @@
check: tests
.PHONY: tests
tests:
......@@ -137,8 +150,8 @@
tests:
# Run Rust tests if cargo is installed
# Run Rust tests if cargo is installed
if command -v $(CARGO) >/dev/null 2>&1; then \
$(MAKE) rust-tests; \
$(MAKE) cargo-clippy; \
fi
cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
......@@ -139,9 +152,10 @@
if command -v $(CARGO) >/dev/null 2>&1; then \
$(MAKE) rust-tests; \
$(MAKE) cargo-clippy; \
fi
cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
.PHONY: test-%
test-%:
cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
......@@ -145,6 +159,7 @@
test-%:
cd tests && $(PYTHON) run-tests.py $(TESTFLAGS) $@
.PHONY: testpy-%
testpy-%:
@echo Looking for Python $* in $(HGPYTHONS)
[ -e $(HGPYTHONS)/$*/bin/python ] || ( \
......@@ -152,5 +167,6 @@
$(MAKE) -f $(HGROOT)/contrib/Makefile.python PYTHONVER=$* PREFIX=$(HGPYTHONS)/$* python )
cd tests && $(HGPYTHONS)/$*/bin/python run-tests.py $(TESTFLAGS)
.PHONY: rust-tests
rust-tests:
cd $(HGROOT)/rust \
......@@ -155,4 +171,5 @@
rust-tests:
cd $(HGROOT)/rust \
&& $(CARGO) test --quiet --all --features "$(HG_RUST_FEATURES)"
&& $(CARGO) test --quiet --all \
--features "$(HG_RUST_FEATURES)" --no-default-features
......@@ -158,5 +175,6 @@
.PHONY: cargo-clippy
cargo-clippy:
cd $(HGROOT)/rust \
&& $(CARGO) clippy --all --features "$(HG_RUST_FEATURES)" -- -D warnings
......@@ -159,7 +177,8 @@
cargo-clippy:
cd $(HGROOT)/rust \
&& $(CARGO) clippy --all --features "$(HG_RUST_FEATURES)" -- -D warnings
.PHONY: check-code
check-code:
hg manifest | xargs python contrib/check-code.py
......@@ -163,7 +182,8 @@
check-code:
hg manifest | xargs python contrib/check-code.py
.PHONY: format-c
format-c:
clang-format --style file -i \
`hg files 'set:(**.c or **.cc or **.h) and not "listfile:contrib/clang-format-ignorelist"'`
......@@ -166,7 +186,8 @@
format-c:
clang-format --style file -i \
`hg files 'set:(**.c or **.cc or **.h) and not "listfile:contrib/clang-format-ignorelist"'`
.PHONY: update-pot
update-pot: i18n/hg.pot
i18n/hg.pot: $(PYFILES) $(DOCFILES) i18n/posplit i18n/hggettext
......@@ -232,6 +253,7 @@
ppa
# Forward packaging targets for convenience.
.PHONY: $(packaging_targets)
$(packaging_targets):
$(MAKE) -C contrib/packaging $(MAKEFLAGS) $@
......@@ -235,31 +257,4 @@
$(packaging_targets):
$(MAKE) -C contrib/packaging $(MAKEFLAGS) $@
osx:
rm -rf build/mercurial
/usr/bin/python2.7 setup.py install --optimize=1 \
--root=build/mercurial/ --prefix=/usr/local/ \
--install-lib=/Library/Python/2.7/site-packages/
make -C doc all install DESTDIR="$(PWD)/build/mercurial/"
# Place a bogon .DS_Store file in the target dir so we can be
# sure it doesn't get included in the final package.
touch build/mercurial/.DS_Store
make -C contrib/chg \
HGPATH=/usr/local/bin/hg \
PYTHON=/usr/bin/python2.7 \
DESTDIR=../../build/mercurial \
PREFIX=/usr/local \
clean install
mkdir -p $${OUTPUTDIR:-dist}
HGVER=$$(python contrib/genosxversion.py $(OSXVERSIONFLAGS) build/mercurial/Library/Python/2.7/site-packages/mercurial/__version__.py) && \
OSXVER=$$(sw_vers -productVersion | cut -d. -f1,2) && \
pkgbuild --filter \\.DS_Store --root build/mercurial/ \
--identifier org.mercurial-scm.mercurial \
--version "$${HGVER}" \
build/mercurial.pkg && \
productbuild --distribution contrib/packaging/macosx/distribution.xml \
--package-path build/ \
--version "$${HGVER}" \
--resources contrib/packaging/macosx/ \
"$${OUTPUTDIR:-dist/}"/Mercurial-"$${HGVER}"-macosx"$${OSXVER}".pkg
......@@ -265,7 +260,8 @@
.PHONY: pyoxidizer
pyoxidizer:
$(PYOXIDIZER) build --path ./rust/hgcli --release
# a temporary target to setup all we need for run-tests.py --pyoxidizer
# (should go away as the run-tests implementation improves
......@@ -266,9 +262,10 @@
pyoxidizer:
$(PYOXIDIZER) build --path ./rust/hgcli --release
# a temporary target to setup all we need for run-tests.py --pyoxidizer
# (should go away as the run-tests implementation improves
.PHONY: pyoxidizer-windows-tests
pyoxidizer-windows-tests: PYOX_DIR=build/pyoxidizer/x86_64-pc-windows-msvc/release/app
pyoxidizer-windows-tests: pyoxidizer
rm -rf $(PYOX_DIR)/templates
......@@ -285,6 +282,7 @@
# a temporary target to setup all we need for run-tests.py --pyoxidizer
# (should go away as the run-tests implementation improves
.PHONY: pyoxidizer-macos-tests
pyoxidizer-macos-tests: PYOX_DIR=build/pyoxidizer/x86_64-apple-darwin/release/app
pyoxidizer-macos-tests: pyoxidizer
rm -rf $(PYOX_DIR)/templates
......@@ -298,5 +296,6 @@
rm -rf $(PYOX_DIR)/doc
cp -a doc $(PYOX_DIR)/doc
.PHONY: pytype-docker
pytype-docker:
contrib/docker/pytype/recipe.sh
......@@ -301,9 +300,2 @@
pytype-docker:
contrib/docker/pytype/recipe.sh
.PHONY: help all local build doc cleanbutpackages clean install install-bin \
install-doc install-home install-home-bin install-home-doc \
dist dist-notests check tests rust-tests check-code format-c \
update-pot pyoxidizer pyoxidizer-windows-tests pyoxidizer-macos-tests \
$(packaging_targets) \
osx pytype-docker
......@@ -332,7 +332,7 @@
pub_full = key_path / f
priv_full = key_path / ('keypair-%s' % name)
with open(pub_full, 'r', encoding='ascii') as fh:
with open(pub_full, encoding='ascii') as fh:
data = fh.read()
if not data.startswith('ssh-rsa '):
......
......@@ -585,7 +585,7 @@
else:
python = '/hgdev/pyenv/shims/python%s' % python_version
test_flags = ' '.join(shlex.quote(a) for a in test_flags)
test_flags = shlex.join(test_flags)
command = (
'/bin/sh -c "export TMPDIR=/hgwork/tmp; '
......
......@@ -46,7 +46,7 @@
)
return client
except socket.error:
except OSError:
pass
except paramiko.AuthenticationException:
raise
......
......@@ -54,10 +54,8 @@
if not reposnames:
raise ValueError("No repositories found in $REPO_DIR")
outputre = re.compile(
(
r'! wall (\d+.\d+) comb \d+.\d+ user \d+.\d+ sys '
r'\d+.\d+ \(best of \d+\)'
)
r'! wall (\d+.\d+) comb \d+.\d+ user \d+.\d+ sys '
r'\d+.\d+ \(best of \d+\)'
)
......@@ -79,7 +77,7 @@
output = ui.popbuffer()
match = outputre.search(output)
if not match:
raise ValueError("Invalid output {}".format(output))
raise ValueError(f"Invalid output {output}")
return float(match.group(1))
......
......@@ -5,7 +5,4 @@
#
set -eu
# enforce that the translation are built
export MERCURIAL_SETUP_FORCE_TRANSLATIONS=1
if [ $# -lt 2 ]; then
......@@ -11,8 +8,8 @@
if [ $# -lt 2 ]; then
echo "usage $0 PYTHONTAG DEST_DIR" >&2
echo "usage $0 PYTHONTAG DEST_DIR [FLAVOR]" >&2
echo "" >&2
echo 'PYTHONTAG should be of the form "cp310-cp310"' >&2
exit 64
fi
py_tag=$1
destination_directory=$2
......@@ -13,9 +10,21 @@
echo "" >&2
echo 'PYTHONTAG should be of the form "cp310-cp310"' >&2
exit 64
fi
py_tag=$1
destination_directory=$2
flavor=${3:-c}
flavor_arg=""
if [[ "${flavor}" == "c" ]]; then
:
elif [[ "$flavor" == "rust" ]]; then
flavor_arg="--config-setting=--global-option=--rust"
else
echo "unknown flavor: \"$flavor\""
exit 96
fi
tmp_wheel_dir=./tmp-wheelhouse
......@@ -23,6 +32,6 @@
if [ -e $tmp_wheel_dir ]; then
rm -rf $tmp_wheel_dir
fi
/opt/python/$py_tag/bin/python setup.py bdist_wheel --dist-dir $tmp_wheel_dir
/opt/python/$py_tag/bin/python -m build --outdir $tmp_wheel_dir $flavor_arg
# adjust it to make it universal
auditwheel repair $tmp_wheel_dir/*.whl -w $destination_directory
......@@ -372,7 +372,7 @@
r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\S',
"missing whitespace around operator",
),
(r'[^^+=*/!<>&| %-](\s=|=\s)[^= ]', "wrong whitespace around ="),
(r'[^^+=*/!<>&| %-:](\s=|=\s)[^= ]', "wrong whitespace around ="),
(
r'raise [^,(]+, (\([^\)]+\)|[^,\(\)]+)$',
"don't use old-style two-argument raise, use Exception(message)",
......@@ -471,7 +471,7 @@
(?# this regexp can't use [^...] style,
# because _preparepats forcibly adds "\n" into [^...],
# even though this regexp wants match it against "\n")''',
"missing _() in ui message (use () to hide false-positives)",
"missing _() in ui message (use `noi18n` method to hide false-positives)",
),
]
+ commonpypats[0],
......@@ -816,7 +816,7 @@
except UnicodeDecodeError as e:
print("%s while reading %s" % (e, f))
return result
except IOError as e:
except OSError as e:
print("Skipping %s, %s" % (f, str(e).split(':', 1)[0]))
return result
......
......@@ -42,7 +42,6 @@
# hgext/remotefilelog/fileserverclient.py # [attribute-error]
# hgext/remotefilelog/shallowbundle.py # [attribute-error]
# hgext/remotefilelog/remotefilectx.py # [module-attr] (This is an actual bug)
# hgext/sqlitestore.py # [attribute-error]
# hgext/zeroconf/__init__.py # bytes vs str; tests fail on macOS
#
# mercurial/context.py # many [attribute-error]
......@@ -54,7 +53,6 @@
# mercurial/hgweb/server.py # [attribute-error], [name-error], [module-attr]
# mercurial/hgweb/wsgicgi.py # confused values in os.environ
# mercurial/httppeer.py # [attribute-error], [wrong-arg-types]
# mercurial/interfaces # No attribute 'capabilities' on peer [attribute-error]
# mercurial/keepalive.py # [attribute-error]
# mercurial/localrepo.py # [attribute-error]
# mercurial/minirst.py # [unsupported-operands], [attribute-error]
......@@ -58,7 +56,6 @@
# mercurial/keepalive.py # [attribute-error]
# mercurial/localrepo.py # [attribute-error]
# mercurial/minirst.py # [unsupported-operands], [attribute-error]
# mercurial/pure/parsers.py # [attribute-error]
# mercurial/repoview.py # [attribute-error]
# mercurial/testing/storage.py # tons of [attribute-error]
# mercurial/win32.py # [not-callable]
......@@ -104,7 +101,6 @@
-x hgext/remotefilelog/fileserverclient.py \
-x hgext/remotefilelog/remotefilectx.py \
-x hgext/remotefilelog/shallowbundle.py \
-x hgext/sqlitestore.py \
-x hgext/zeroconf/__init__.py \
-x mercurial/context.py \
-x mercurial/crecord.py \
......@@ -115,7 +111,6 @@
-x mercurial/hgweb/server.py \
-x mercurial/hgweb/wsgicgi.py \
-x mercurial/httppeer.py \
-x mercurial/interfaces \
-x mercurial/keepalive.py \
-x mercurial/localrepo.py \
-x mercurial/minirst.py \
......@@ -119,7 +114,6 @@
-x mercurial/keepalive.py \
-x mercurial/localrepo.py \
-x mercurial/minirst.py \
-x mercurial/pure/parsers.py \
-x mercurial/repoview.py \
-x mercurial/testing/storage.py \
-x mercurial/thirdparty \
......
#!/bin/bash
# A small script to cleanup old CI-pipeline that accumulate over time
d="`date -d '-1 month' --iso-8601`T00:00:00Z"
PROJECT_ID=22
token=$1
if [ -z $token ]; then
echo "USAGE: $0 GITLAB_TOKEN" >&2
exit 64
fi
get_ids() {
curl --silent "https://foss.heptapod.net/api/v4/projects/$PROJECT_ID/pipelines?updated_before=$d&per_page=100" | python3 -m json.tool | grep -E '"\bid": ([0-9]+),' | grep -oE '[0-9]+'
}
ids=`get_ids`
while [ -n "$ids" ]; do
echo '#########'
for pipeline_id in $ids; do
echo "deleting pipeline #$pipeline_id"
url="https://foss.heptapod.net/api/v4/projects/$PROJECT_ID/pipelines/$pipeline_id"
echo $url
curl \
--header "PRIVATE-TOKEN: $token"\
--request "DELETE"\
$url
done
ids=`get_ids`
if [ -n "$ids" ]; then
sleep 1
fi
done
......@@ -2,6 +2,7 @@
USER ci-runner
RUN mkdir /home/ci-runner/.local/
ENV PATH=/home/ci-runner/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV PYTHONPATH=/home/ci-runner/.local/lib/python3.11/site-packages
......
#w Don't run pipelines on branch "merge", since we're fast-forward only.
# Don't run pipelines on branch "merge", since we're fast-forward only.
# Gitlab sees a new branch (since e.g. `topic/stable/my-topic` becomes
# `branch/stable`), but the hash hasn't changed. There is no reason to
# re-run the CI in our case, since we haven't built up any specific automation.
......@@ -46,9 +46,6 @@
# with shell runner, its content is not cleaned from one call to the next,
# so plan for it.
TMP_WORK_DIR: "${CI_PROJECT_DIR}/../.."
# we use CIBW_SKIP="pp*" to prevent the building of pypy wheel that are neither
# needed nor working.
CIBW_SKIP: "pp*"
.all:
# help changing all job at once when debugging
......@@ -100,7 +97,6 @@
variables:
WHEEL_TYPE: ""
FLAVOR: ""
MERCURIAL_SETUP_FORCE_TRANSLATIONS: "1"
CI_CLEVER_CLOUD_FLAVOR: "XS"
script:
- PLATFORM=`/opt/python/cp313-cp313/bin/python -c 'import sys; print(sys.platform)'`
......@@ -108,7 +104,7 @@
- test -n "$WHEEL_TYPE"
- echo $FLAVOR
- mkdir -p wheels/$PLATFORM/$WHEEL_TYPE/$BUILD_PY_ID
- contrib/build-one-linux-wheel.sh $BUILD_PY_ID wheels/$PLATFORM/$WHEEL_TYPE/$BUILD_PY_ID
- contrib/build-one-linux-wheel.sh $BUILD_PY_ID wheels/$PLATFORM/$WHEEL_TYPE/$BUILD_PY_ID $WHEEL_TYPE
artifacts:
paths:
- wheels/
......@@ -123,6 +119,7 @@
parallel:
matrix:
- BUILD_PY_ID:
- cp311-cp311
- cp38-cp38
- cp39-cp39
- cp310-cp310
......@@ -126,7 +123,6 @@
- cp38-cp38
- cp39-cp39
- cp310-cp310
- cp311-cp311
- cp312-cp312
- cp313-cp313
......@@ -130,13 +126,9 @@
- cp312-cp312
- cp313-cp313
trigger-wheel-musl:
extends: .trigger
stage: build
rules:
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG)
when: never
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
when: manual
allow_failure: true
build-rust-wheel:
image: "registry.heptapod.net:443/mercurial/ci-images/core-wheel-x86_64-rust:v3.0"
extends: build-c-wheel
variables:
WHEEL_TYPE: "rust"
......@@ -142,16 +134,5 @@
build-c-wheel-musl:
extends: build-c-wheel
image: "registry.heptapod.net/mercurial/ci-images/core-wheel-x86_64-musl-c:v3.0"
rules:
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG)
needs:
- trigger-nightly-build
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
needs:
- "trigger-wheel-musl"
trigger-wheel-i686:
.wheel-trigger:
extends: .trigger
stage: build
rules:
......@@ -161,5 +142,5 @@
when: manual
allow_failure: true
build-c-wheel-i686:
.extra-c-wheel:
extends: build-c-wheel
......@@ -165,29 +146,7 @@
extends: build-c-wheel
image: "registry.heptapod.net/mercurial/ci-images/core-wheel-i686-c:v3.0"
rules:
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG)
needs:
- trigger-nightly-build
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
needs:
- "trigger-wheel-i686"
trigger-wheel-i686-musl:
extends: .trigger
stage: build
rules:
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG)
when: never
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
when: manual
allow_failure: true
build-c-wheel-i686-musl:
extends: build-c-wheel
image: "registry.heptapod.net/mercurial/ci-images/core-wheel-i686-musl-c:v3.0"
rules:
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG)
needs:
- trigger-nightly-build
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
needs:
......@@ -188,9 +147,30 @@
rules:
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG)
needs:
- trigger-nightly-build
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
needs:
- "trigger-wheel-i686-musl"
- "trigger-wheel-musl"
trigger-wheel-musl:
extends: .wheel-trigger
build-c-wheel-musl:
extends: .extra-c-wheel
image: "registry.heptapod.net/mercurial/ci-images/core-wheel-x86_64-musl-c:v3.0"
trigger-wheel-i686:
extends: .wheel-trigger
build-c-wheel-i686:
extends: .extra-c-wheel
image: "registry.heptapod.net/mercurial/ci-images/core-wheel-i686-c:v3.0"
trigger-wheel-i686-musl:
extends: .wheel-trigger
build-c-wheel-i686-musl:
extends: .extra-c-wheel
image: "registry.heptapod.net/mercurial/ci-images/core-wheel-i686-musl-c:v3.0"
trigger-wheel-arm64:
......@@ -195,12 +175,5 @@
trigger-wheel-arm64:
extends: .trigger
stage: build
rules:
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG)
when: never
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
when: manual
allow_failure: true
extends: .wheel-trigger
build-c-wheel-arm64:
......@@ -205,6 +178,6 @@
build-c-wheel-arm64:
extends: build-c-wheel
extends: .extra-c-wheel
image: "registry.heptapod.net/mercurial/ci-images/core-wheel-arm64-c:v3.0"
tags:
- arm64
......@@ -208,12 +181,5 @@
image: "registry.heptapod.net/mercurial/ci-images/core-wheel-arm64-c:v3.0"
tags:
- arm64
rules:
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG)
needs:
- trigger-nightly-build
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
needs:
- "trigger-wheel-arm64"
trigger-wheel-arm64-musl:
......@@ -218,12 +184,5 @@
trigger-wheel-arm64-musl:
extends: .trigger
stage: build
rules:
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG)
when: never
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
when: manual
allow_failure: true
extends: .wheel-trigger
build-c-wheel-arm64-musl:
......@@ -228,6 +187,6 @@
build-c-wheel-arm64-musl:
extends: build-c-wheel
extends: .extra-c-wheel
image: "registry.heptapod.net/mercurial/ci-images/core-wheel-arm64-musl-c:v3.0"
tags:
- arm64
......@@ -231,13 +190,6 @@
image: "registry.heptapod.net/mercurial/ci-images/core-wheel-arm64-musl-c:v3.0"
tags:
- arm64
rules:
- if: ($CI_COMMIT_BRANCH =~ $RE_BRANCH || $CI_COMMIT_TAG)
needs:
- trigger-nightly-build
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
needs:
- "trigger-wheel-arm64-musl"
.runtests:
extends: .all
......@@ -257,7 +209,7 @@
- hg clone . "${TMP_WORK_DIR}"/mercurial-ci/ --noupdate --config phases.publish=no
- hg -R "${TMP_WORK_DIR}"/mercurial-ci/ update `hg log --rev '.' --template '{node}'`
- cd "${TMP_WORK_DIR}"/mercurial-ci/
- ls -1 tests/test-check-*.* > "${TMP_WORK_DIR}"/check-tests.txt
- ls -1 tests/test-check-*.* tests/test-contrib-check-*.t > "${TMP_WORK_DIR}"/check-tests.txt
script:
- echo "$TEST_HGTESTS_ALLOW_NETIO"
- echo "$RUNTEST_ARGS"
......@@ -279,8 +231,10 @@
test -n "$WHEEL";
echo installing from $WHEEL;
WHEEL_ARG="--hg-wheel $WHEEL";
echo disabling flavor as this is currently incompatible with '"--hg-wheel"';
FLAVOR="";
if [[ -n "$FLAVOR" ]] && [[ "$FLAVOR" != "--rust" ]]; then
echo disabling flavor '"'$FLAVOR'"' as this is currently incompatible with '"--hg-wheel"';
FLAVOR="";
fi
else
echo installing from source;
fi;
......@@ -284,8 +238,8 @@
else
echo installing from source;
fi;
- if [ -n "$CI_NODE_INDEX" ]; then
- if [ -n "$CI_NODE_INDEX" ]; then
echo "Running the test in multiple shard - [$CI_NODE_INDEX/$CI_NODE_TOTAL]";
SHARDING_ARGS="--shard-index $CI_NODE_INDEX --shard-total $CI_NODE_TOTAL";
echo "sharding... $SHARDING_ARGS";
fi
......@@ -288,7 +242,9 @@
echo "Running the test in multiple shard - [$CI_NODE_INDEX/$CI_NODE_TOTAL]";
SHARDING_ARGS="--shard-index $CI_NODE_INDEX --shard-total $CI_NODE_TOTAL";
echo "sharding... $SHARDING_ARGS";
fi
- echo HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO" "$PYTHON" tests/run-tests.py
--color=always --tail-report $PORT_ARG $WHEEL_ARG $FLAVOR $SHARDING_ARGS $FILTER $RUNTEST_ARGS;
- HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO"
"$PYTHON" tests/run-tests.py
--color=always
......@@ -292,6 +248,7 @@
- HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO"
"$PYTHON" tests/run-tests.py
--color=always
--tail-report
$PORT_ARG
$WHEEL_ARG
$FLAVOR
......@@ -343,9 +300,9 @@
variables:
FLAVOR: "--pure"
test-rust:
.test-rust:
extends: .runtests-no-check
variables:
HGWITHRUSTEXT: "cpython"
FLAVOR: "--rust"
......@@ -347,8 +304,21 @@
extends: .runtests-no-check
variables:
HGWITHRUSTEXT: "cpython"
FLAVOR: "--rust"
test-rust:
extends: .test-rust
variables:
HGWITHRUSTEXT: "cpython"
FLAVOR: "--rust"
needs:
- job: build-rust-wheel
parallel:
matrix:
- BUILD_PY_ID: "cp311-cp311"
variables:
WHEEL_TYPE: "rust"
test-rhg:
extends: .runtests-no-check
variables:
......@@ -405,7 +375,7 @@
- BUILD_PY_ID: "cp312-cp312"
test-3.12-rust:
extends: test-rust
extends: .test-rust
stage: py-version-compat
needs:
- trigger-pycompat
......@@ -424,7 +394,7 @@
- BUILD_PY_ID: "cp313-cp313"
test-3.13-rust:
extends: test-rust
extends: .test-rust
stage: py-version-compat
needs:
- trigger-pycompat
......@@ -432,7 +402,7 @@
PYTHON: python3.13
check-pytype:
extends: test-rust
extends: .test-rust
stage: checks
before_script:
- export PATH="/home/ci-runner/vendor/pyenv/pyenv-2.4.7-adf3c2bccf09cdb81febcfd15b186711a33ac7a8/shims:/home/ci-runner/vendor/pyenv/pyenv-2.4.7-adf3c2bccf09cdb81febcfd15b186711a33ac7a8/bin:$PATH"
......@@ -440,6 +410,9 @@
- hg clone . "${TMP_WORK_DIR}"/mercurial-ci/ --noupdate --config phases.publish=no
- hg -R "${TMP_WORK_DIR}"/mercurial-ci/ update `hg log --rev '.' --template '{node}'`
- cd "${TMP_WORK_DIR}"/mercurial-ci/
- echo $HGWITHRUSTEXT
# We need to unset HGWITHRUSTEXT since editable install is broken with Rust
- unset HGWITHRUSTEXT
- make local PYTHON=$PYTHON
- ./contrib/setup-pytype.sh
script:
......@@ -487,8 +460,6 @@
- if: $CI_COMMIT_BRANCH =~ $RE_TOPIC
needs:
- "trigger-wheel-windows"
variables:
MERCURIAL_SETUP_FORCE_TRANSLATIONS: "1"
script:
- echo "Entering script section"
- echo "python used, $Env:PYTHON"
......@@ -550,6 +521,7 @@
&& HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO"
$PYTHON tests/run-tests.py
--color=always
--tail-report
$WHEEL_ARG
$FLAVOR
--port `expr 19051 + 1009 "*" $CI_CONCURRENT_ID`
......@@ -577,5 +549,5 @@
windows-pyox:
extends: .windows-runtests
when: manual # pyoxidizer builds seem broken with --no-use-pep517
when: manual
variables:
......@@ -581,4 +553,6 @@
variables:
RUNTEST_ARGS: ""
WHEEL_ARG: ""
FLAVOR: "--pyoxidized"
macos:
......@@ -599,8 +573,6 @@
# this is the only one we need to test. However testing that build work on all
# version is useful and match what we do with Linux.
#
# CIBW_SKIP is set globally at the start of the file. See comment there.
#
# The weird directory structure match the one we use for Linux to deal with the
# multiple jobs. (all this might be unnecessary)
build-c-wheel-macos:
......@@ -612,5 +584,8 @@
when: manual # avoid overloading the CI by default
allow_failure: true
stage: build
variables:
# TODO: drop this when CI system is updated to support arm64 builds
CIBW_ARCHS: "x86_64"
tags:
- macos
......@@ -615,8 +590,6 @@
tags:
- macos
variables:
MERCURIAL_SETUP_FORCE_TRANSLATIONS: "1"
script:
- PLATFORM=`$PYTHON -c 'import sys; print(sys.platform)'`
- rm -rf tmp-wheels
- cibuildwheel --output-dir tmp-wheels/
......@@ -619,8 +592,9 @@
script:
- PLATFORM=`$PYTHON -c 'import sys; print(sys.platform)'`
- rm -rf tmp-wheels
- cibuildwheel --output-dir tmp-wheels/
- for py_version in cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313; do
- for py_version in $(cibuildwheel --print-build-identifiers | egrep -o 'cp[0-9]+' | sort | uniq); do
py_version="${py_version}-${py_version}";
mkdir -p wheels/$PLATFORM/c/$py_version/;
mv tmp-wheels/*$py_version*.whl wheels/$PLATFORM/c/$py_version/;
done
......
#!/usr/bin/env python3
#
# hgperf - measure performance of Mercurial commands
#
# Copyright 2014 Olivia Mackall <olivia@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
'''measure performance of Mercurial commands
Using ``hgperf`` instead of ``hg`` measures performance of the target
Mercurial command. For example, the execution below measures
performance of :hg:`heads --topo`::
$ hgperf heads --topo
All command output via ``ui`` is suppressed, and just measurement
result is displayed: see also "perf" extension in "contrib".
Costs of processing before dispatching to the command function like
below are not measured::
- parsing command line (e.g. option validity check)
- reading configuration files in
But ``pre-`` and ``post-`` hook invocation for the target command is
measured, even though these are invoked before or after dispatching to
the command function, because these may be required to repeat
execution of the target command correctly.
'''
import os
import sys
libdir = '@LIBDIR@'
if libdir != '@' 'LIBDIR' '@':
if not os.path.isabs(libdir):
libdir = os.path.join(
os.path.dirname(os.path.realpath(__file__)), libdir
)
libdir = os.path.abspath(libdir)
sys.path.insert(0, libdir)
# enable importing on demand to reduce startup time
try:
from mercurial import demandimport
demandimport.enable()
except ImportError:
import sys
sys.stderr.write(
"abort: couldn't find mercurial libraries in [%s]\n"
% ' '.join(sys.path)
)
sys.stderr.write("(check your install and PYTHONPATH)\n")
sys.exit(-1)
from mercurial import (
dispatch,
util,
)
def timer(func, title=None):
results = []
begin = util.timer()
count = 0
while True:
ostart = os.times()
cstart = util.timer()
r = func()
cstop = util.timer()
ostop = os.times()
count += 1
a, b = ostart, ostop
results.append((cstop - cstart, b[0] - a[0], b[1] - a[1]))
if cstop - begin > 3 and count >= 100:
break
if cstop - begin > 10 and count >= 3:
break
if title:
sys.stderr.write("! %s\n" % title)
if r:
sys.stderr.write("! result: %s\n" % r)
m = min(results)
sys.stderr.write(
"! wall %f comb %f user %f sys %f (best of %d)\n"
% (m[0], m[1] + m[2], m[1], m[2], count)
)
orgruncommand = dispatch.runcommand
def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions):
ui.pushbuffer()
lui.pushbuffer()
timer(
lambda: orgruncommand(
lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions
)
)
ui.popbuffer()
lui.popbuffer()
dispatch.runcommand = runcommand
dispatch.run()
......@@ -3,7 +3,6 @@
import ast
import collections
import io
import os
import sys
......@@ -27,6 +26,8 @@
'mercurial.hgweb.request',
'mercurial.i18n',
'mercurial.interfaces',
'mercurial.interfaces._basetypes',
'mercurial.interfaces.types',
'mercurial.node',
'mercurial.pycompat',
# for revlog to re-export constant to extensions
......@@ -43,8 +44,6 @@
'mercurial.thirdparty.attr',
'mercurial.thirdparty.jaraco.collections',
'mercurial.thirdparty.tomli',
'mercurial.thirdparty.zope',
'mercurial.thirdparty.zope.interface',
'typing',
'xml.etree.ElementTree',
)
......@@ -219,7 +218,6 @@
>>> 'cffi' in mods
True
"""
for m in sys.builtin_module_names:
yield m
yield from sys.builtin_module_names
# These modules only exist on windows, but we should always
# consider them stdlib.
......@@ -224,10 +222,9 @@
# These modules only exist on windows, but we should always
# consider them stdlib.
for m in ['msvcrt', '_winreg']:
yield m
yield from ['msvcrt', '_winreg']
yield '__builtin__'
yield 'builtins' # python3 only
yield 'importlib.abc' # python3 only
yield 'importlib.machinery' # python3 only
yield 'importlib.util' # python3 only
yield 'packaging.version'
......@@ -228,15 +225,12 @@
yield '__builtin__'
yield 'builtins' # python3 only
yield 'importlib.abc' # python3 only
yield 'importlib.machinery' # python3 only
yield 'importlib.util' # python3 only
yield 'packaging.version'
for m in 'fcntl', 'grp', 'pwd', 'select', 'termios': # Unix only
yield m
for m in 'cPickle', 'datetime': # in Python (not C) on PyPy
yield m
for m in ['cffi']:
yield m
yield from ['fcntl', 'grp', 'pwd', 'select', 'termios']
yield from ['cPickle', 'datetime']
yield from ['cffi']
yield 'distutils' # in Python < 3.12
yield 'distutils.version' # in Python < 3.12
stdlib_prefixes = {sys.prefix, sys.exec_prefix}
......@@ -445,5 +439,5 @@
if newscope:
# Check for local imports in function
for r in verify_modern_convention(
yield from verify_modern_convention(
module, node, localmods, node.col_offset + 4
......@@ -449,6 +443,5 @@
module, node, localmods, node.col_offset + 4
):
yield r
)
elif isinstance(node, ast.Import):
# Disallow "import foo, bar" and require separate imports
# for each module.
......@@ -713,7 +706,7 @@
# Python source file encoding. But in reality we don't use anything
# other than ASCII (mainly) and UTF-8 (in a few exceptions), so
# simplicity is fine.
with io.open(f, 'r', encoding='utf-8') as src:
with open(f, encoding='utf-8') as src:
for script, modname, t, line in embedded(f, modname, src):
yield script, modname.encode('utf8'), t, line
......
......@@ -16,8 +16,8 @@
#
# The script is tested on Windows 10 and Windows Server 2019 (in EC2).
$VS_BUILD_TOOLS_URL = "https://download.visualstudio.microsoft.com/download/pr/a1603c02-8a66-4b83-b821-811e3610a7c4/aa2db8bb39e0cbd23e9940d8951e0bc3/vs_buildtools.exe"
$VS_BUILD_TOOLS_SHA256 = "911E292B8E6E5F46CBC17003BDCD2D27A70E616E8D5E6E69D5D489A605CAA139"
$VS_BUILD_TOOLS_URL = "https://download.visualstudio.microsoft.com/download/pr/f2819554-a618-400d-bced-774bb5379965/cc7231dc668ec1fb92f694c66b5d67cba1a9e21127a6e0b31c190f772bd442f2/vs_BuildTools.exe"
$VS_BUILD_TOOLS_SHA256 = "CC7231DC668EC1FB92F694C66B5D67CBA1A9E21127A6E0B31C190F772BD442F2"
$PYTHON38_x86_URL = "https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe"
$PYTHON38_x86_SHA256 = "ad07633a1f0cd795f3bf9da33729f662281df196b4567fa795829f3bb38a30ac"
......@@ -54,6 +54,9 @@
$PIP_URL = "https://github.com/pypa/get-pip/raw/66d8a0f637083e2c3ddffc0cb1e65ce126afb856/public/get-pip.py"
$PIP_SHA256 = "6FB7B781206356F45AD79EFBB19322CAA6C2A5AD39092D0D44D0FEC94117E118"
$GETTEXT_SETUP_URL = "https://github.com/mlocati/gettext-iconv-windows/releases/download/v0.22.5a-v1.17-r3/gettext0.22.5a-iconv1.17-shared-64.exe"
$GETTEXT_SETUP_SHA256 = "EF56AD2C395F8F75F711574E754171EEFD45640746FA117D001969A40655CEBE"
$INNO_SETUP_URL = "http://files.jrsoftware.org/is/5/innosetup-5.6.1-unicode.exe"
$INNO_SETUP_SHA256 = "27D49E9BC769E9D1B214C153011978DB90DC01C2ACD1DDCD9ED7B3FE3B96B538"
......@@ -57,6 +60,6 @@
$INNO_SETUP_URL = "http://files.jrsoftware.org/is/5/innosetup-5.6.1-unicode.exe"
$INNO_SETUP_SHA256 = "27D49E9BC769E9D1B214C153011978DB90DC01C2ACD1DDCD9ED7B3FE3B96B538"
$MINGW_BIN_URL = "https://osdn.net/frs/redir.php?m=constant&f=mingw%2F68260%2Fmingw-get-0.6.3-mingw32-pre-20170905-1-bin.zip"
$MINGW_BIN_URL = "https://www.mercurial-scm.org/release/windows/mingw-get-bin.zip"
$MINGW_BIN_SHA256 = "2AB8EFD7C7D1FC8EAF8B2FA4DA4EEF8F3E47768284C021599BC7435839A046DF"
......@@ -61,8 +64,8 @@
$MINGW_BIN_SHA256 = "2AB8EFD7C7D1FC8EAF8B2FA4DA4EEF8F3E47768284C021599BC7435839A046DF"
$MERCURIAL_WHEEL_FILENAME = "mercurial-6.1.4-cp39-cp39-win_amd64.whl"
$MERCURIAL_WHEEL_URL = "https://files.pythonhosted.org/packages/82/86/fbcc4b552f6c1bdfdbbc5a68b0896a55ac3c6c0e8baf51394816bdc320bd/$MERCURIAL_WHEEL_FILENAME"
$MERCURIAL_WHEEL_SHA256 = "ab578daec7c21786c668b0da2e71282a290d18010255719f78d0e55145020d46"
$MERCURIAL_WHEEL_FILENAME = "mercurial-6.9-cp39-cp39-win_amd64.whl"
$MERCURIAL_WHEEL_URL = "https://files.pythonhosted.org/packages/ca/60/3dd09a2c30067ed003f7ec05f704bd69e9adf19c794b0a6351e75499dda1/$MERCURIAL_WHEEL_FILENAME"
$MERCURIAL_WHEEL_SHA256 = "ec2a00f73da23123c52ec68206b6ebed1a214c569cda37aaab7b343ef539c7c3"
$RUSTUP_INIT_URL = "https://static.rust-lang.org/rustup/archive/1.21.1/x86_64-pc-windows-gnu/rustup-init.exe"
$RUSTUP_INIT_SHA256 = "d17df34ba974b9b19cf5c75883a95475aa22ddc364591d75d174090d55711c72"
......@@ -126,7 +129,7 @@
$allusers = "0"
}
Invoke-Process $installer "/quiet TargetDir=${dest} InstallAllUsers=${allusers} AssociateFiles=0 CompileAll=0 PrependPath=0 Include_doc=0 Include_launcher=0 InstallLauncherAllUsers=0 Include_pip=0 Include_test=0"
Invoke-Process $installer "/quiet TargetDir=${dest} InstallAllUsers=${allusers} AssociateFiles=0 CompileAll=0 PrependPath=0 Include_doc=0 Include_launcher=1 InstallLauncherAllUsers=1 Include_pip=0 Include_test=0"
Invoke-Process ${dest}\python.exe $pip
}
......@@ -163,6 +166,7 @@
Secure-Download $PIP_URL ${pip} $PIP_SHA256
Secure-Download $VS_BUILD_TOOLS_URL ${prefix}\assets\vs_buildtools.exe $VS_BUILD_TOOLS_SHA256
Secure-Download $GETTEXT_SETUP_URL ${prefix}\assets\gettext.exe $GETTEXT_SETUP_SHA256
Secure-Download $INNO_SETUP_URL ${prefix}\assets\InnoSetup.exe $INNO_SETUP_SHA256
Secure-Download $MINGW_BIN_URL ${prefix}\assets\mingw-get-bin.zip $MINGW_BIN_SHA256
Secure-Download $MERCURIAL_WHEEL_URL ${prefix}\assets\${MERCURIAL_WHEEL_FILENAME} $MERCURIAL_WHEEL_SHA256
......@@ -182,11 +186,11 @@
Install-Python3 "Python 3.13 32-bit" ${prefix}\assets\python313-x86.exe ${prefix}\python313-x86 ${pip}
Install-Python3 "Python 3.13 64-bit" ${prefix}\assets\python313-x64.exe ${prefix}\python313-x64 ${pip}
Write-Output "installing Visual Studio 2017 Build Tools and SDKs"
Invoke-Process ${prefix}\assets\vs_buildtools.exe "--quiet --wait --norestart --nocache --channelUri https://aka.ms/vs/15/release/channel --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Component.Windows10SDK.17763 --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.Windows10SDK --add Microsoft.VisualStudio.Component.VC.140 --add Microsoft.VisualStudio.Component.VC.Tools.ARM64"
Write-Output "installing Visual Studio 2022 Build Tools and SDKs"
Invoke-Process ${prefix}\assets\vs_buildtools.exe "--quiet --wait --norestart --nocache --channelUri https://aka.ms/vs/17/release/channel --config $PSScriptRoot\vs2022-settings.json"
Write-Output "installing PyOxidizer"
Invoke-Process msiexec.exe "/i ${prefix}\assets\PyOxidizer.msi /l* ${prefix}\assets\PyOxidizer.log /quiet"
Install-Rust ${prefix}
......@@ -187,9 +191,12 @@
Write-Output "installing PyOxidizer"
Invoke-Process msiexec.exe "/i ${prefix}\assets\PyOxidizer.msi /l* ${prefix}\assets\PyOxidizer.log /quiet"
Install-Rust ${prefix}
Write-Output "installing GetText Setup"
Invoke-Process ${prefix}\assets\gettext.exe "/SP- /VERYSILENT /SUPPRESSMSGBOXES"
Write-Output "installing Inno Setup"
Invoke-Process ${prefix}\assets\InnoSetup.exe "/SP- /VERYSILENT /SUPPRESSMSGBOXES"
......