2019-12-10 02:24:31 +03:00
|
|
|
#chg-compatible
|
|
|
|
|
windows: switch to the new Python runtime
Summary:
Switch to the new Python runtime. Remove parts that are incompatible and no
longer necessary, including:
- Building curses, python-lz4, and urllib3 (in build_nupkg.py).
- Mangling sys.path (in hgpython and entrypoint.py).
- Zip-related logic (in hgpython).
- Cargo features controlling build environment (in hgpython and hgmain).
- Zipping Python stdlib (in setup.py).
- Shipping files in `templates`, `help`, and most `contrib` files (in
setup.py).
For the hgpython part, the new expectation is: in all cases (windows, linux,
make local, installed, buck), `edenscm.mercurial.entrypoint` and
`edenscmnative` modules are always directly importable and are always the
expected modules if imported. So the `hg` logic just imports and runs it
without having any `sys.path` related logic.
To explain it further:
- When installed on a POSIX system, the default `sys.path` contains
site-packages. Both edenscm and edenscmnative are in site-packages.
- When installed on Windows, the executable (hg.real.exe), python27.dll,
python27.zip, and edenscmnative/ are all in a same directory. Therefore the
default sys.path (exe dir + python27.zip) would be sufficient.
- When using `make local`, and run via `scm/hg/hg`, the `PySys_SetArgv` API
(called by `hgpython`) inserts the `scm/hg` directory as `sys.path[0]`,
therefore edenscm and edenscmnative in `scm/hg` will be imported as expected.
Since we no longer hard code paths to search for modules, this should fix
issues on systems with a different sys.path, ex. debian and ubuntu uses
"dist-packages" instead of "site-packages".
Note: IPython is broken. It seems to be a combination of newer Python version,
newer compiler and 64 bit (see [1]). It looks like prompt_toolkit incorrectly
uses untyped ctypes APIs where it passes "int/long"s to places expecting a
HANDLE. The ctypes library uses 4-byte integers for plain "int/long"s where a
HANDLE is 8 byte on 64 bit Windows. The new interpreter is stricter somehow
and will error out in this case (also explains why D15912516 is needed).
The fix to prompt_toolkit was sent as
https://github.com/prompt-toolkit/python-prompt-toolkit/pull/930.
[1]: https://github.com/prompt-toolkit/python-prompt-toolkit/issues/406
Reviewed By: ikostia
Differential Revision: D15894694
fbshipit-source-id: 560d11ae28c1e65d58b760eac93701e753bd397e
2019-06-24 18:30:11 +03:00
|
|
|
#require test-repo normal-layout
|
2017-01-25 16:39:17 +03:00
|
|
|
|
|
|
|
$ . "$TESTDIR/helpers-testrepo.sh"
|
2019-08-20 02:57:31 +03:00
|
|
|
$ enable amend undo
|
2017-01-25 16:39:17 +03:00
|
|
|
$ cat <<'EOF' > scanhelptopics.py
|
|
|
|
> from __future__ import absolute_import, print_function
|
|
|
|
> import re
|
|
|
|
> import sys
|
2017-03-19 21:42:45 +03:00
|
|
|
> if sys.platform == "win32":
|
|
|
|
> import os, msvcrt
|
|
|
|
> msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
|
2017-01-25 16:39:17 +03:00
|
|
|
> topics = set()
|
|
|
|
> topicre = re.compile(r':hg:`help ([a-z0-9\-.]+)`')
|
|
|
|
> for fname in sys.argv:
|
|
|
|
> with open(fname) as f:
|
|
|
|
> topics.update(m.group(1) for m in topicre.finditer(f.read()))
|
|
|
|
> for s in sorted(topics):
|
|
|
|
> print(s)
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ cd "$TESTDIR"/..
|
|
|
|
|
|
|
|
Check if ":hg:`help TOPIC`" is valid:
|
|
|
|
(use "xargs -n1 -t" to see which help commands are executed)
|
|
|
|
|
2020-08-19 10:31:05 +03:00
|
|
|
$ NPROC=`hg debugsh -c 'import multiprocessing; ui.write(str(multiprocessing.cpu_count()))'`
|
2019-01-29 05:29:48 +03:00
|
|
|
$ testrepohg files 'glob:edenscm/**/*.py' \
|
2017-06-28 03:24:31 +03:00
|
|
|
> | sed 's|\\|/|g' \
|
2018-07-26 02:34:49 +03:00
|
|
|
> | xargs $PYTHON "$TESTTMP/scanhelptopics.py" > $TESTTMP/topics
|
2018-07-10 03:55:01 +03:00
|
|
|
|
|
|
|
Remove subversion from the list; it does not work on macOS and casuses this test
|
|
|
|
to print errors.
|
2018-07-26 02:34:49 +03:00
|
|
|
$ grep -v subversion $TESTTMP/topics > $TESTTMP/topics_filtered
|
2019-08-20 02:57:31 +03:00
|
|
|
$ cat $TESTTMP/topics_filtered | xargs -n1 -P $NPROC hg --cwd / help >/dev/null
|