Mercurial > hg
view tests/test-tools.t @ 43678:52e4bfebc4ba
setup: conditionalize access to `sys.dllhandle` when building extensions
This code is only run on Windows, and was crashing PyOxidizer when running in
`setup-py-install` mode. Now an oxidized binary can be built by simply pointing
to setup.py.
Something is slightly different now that it's not being built from a virtualenv.
Previously, `hg version` could print to the screen, but now it aborts saying
"Incorrect function". But I can see the output if redirected to a file, and
it's not complaining about missing C extensions, so I think those are loading
now (unlike from the virtualenv). The interesting this about this incorrect
function output is that it failed when initially built. I then went back and
did a `make clean` and `make local` with py3 and then py2 to ensure I didn't
break the existing code. At that point I ran the oxidized executable again and
it was able to print to the screen normally! So I ran `pyoxidizer build` again,
it only output the following, and then running the executable failed to output
again:
(pyO2_venv) C:\Users\Matt\hg3\hg_pyO2>pyoxidizer build
Finished dev [unoptimized + debuginfo] target(s) in 0.12s
packaging application into C:/Users/Matt/hg3/hg_pyO2\build\apps\hg_pyO2\x86_64-pc-windows-msvc\debug
purging C:/Users/Matt/hg3/hg_pyO2\build\apps\hg_pyO2\x86_64-pc-windows-msvc\debug
copying C:/Users/Matt/hg3/hg_pyO2\build\target\x86_64-pc-windows-msvc\debug\hg_pyO2.exe to
C:/Users/Matt/hg3/hg_pyO2\build\apps\hg_pyO2\x86_64-pc-windows-msvc\debug\hg_pyO2.exe
resolving packaging state...
writing license for [...]
hg_pyO2 packaged into C:/Users/Matt/hg3/hg_pyO2\build\apps\hg_pyO2\x86_64-pc-windows-msvc\debug
executable path: C:/Users/Matt/hg3/hg_pyO2\build\apps\hg_pyO2\x86_64-pc-windows-msvc\debug\hg_pyO2.exe
Differential Revision: https://phab.mercurial-scm.org/D7444
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 16 Nov 2019 12:19:43 -0500 |
parents | 5abc47d4ca6b |
children | 9172bd49cedc |
line wrap: on
line source
Tests of the file helper tool $ f -h ?sage: f [options] [filenames] (glob) ?ptions: (glob) -h, --help show this help message and exit -t, --type show file type (file or directory) -m, --mode show file mode -l, --links show number of links -s, --size show size of file -n NEWER, --newer=NEWER check if file is newer (or same) -r, --recurse recurse into directories -S, --sha1 show sha1 hash of the content --sha256 show sha256 hash of the content -M, --md5 show md5 hash of the content -D, --dump dump file content -H, --hexdump hexdump file content -B BYTES, --bytes=BYTES number of characters to dump -L LINES, --lines=LINES number of lines to dump -q, --quiet no default output $ mkdir dir $ cd dir $ f --size size=0 $ echo hello | f --md5 --size size=6, md5=b1946ac92492d2347c6235b4d2611184 $ f foo foo: file not found $ echo foo > foo $ f foo foo: $ f --sha1 foo foo: sha1=f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 $ f --sha256 foo foo: sha256=b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c #if symlink $ f foo --mode foo: mode=644 #endif #if no-windows $ "$PYTHON" $TESTDIR/seq.py 10 > bar #else Convert CRLF -> LF for consistency $ "$PYTHON" $TESTDIR/seq.py 10 | sed "s/$//" > bar #endif #if unix-permissions symlink $ chmod +x bar $ f bar --newer foo --mode --type --size --dump --links --bytes 7 bar: file, size=21, mode=755, links=1, newer than foo >>> 1 2 3 4 <<< no trailing newline #endif #if unix-permissions $ ln bar baz $ f bar -n baz -l --hexdump -t --sha1 --lines=9 -B 20 bar: file, links=2, newer than baz, sha1=612ca68d0305c821750a 0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.| 0010: 39 0a |9.| $ rm baz #endif #if unix-permissions symlink $ ln -s yadda l $ f . --recurse -MStmsB4 .: directory with 3 files, mode=755 ./bar: file, size=21, mode=755, md5=3b03, sha1=612c ./foo: file, size=4, mode=644, md5=d3b0, sha1=f1d2 ./l: link, size=5, md5=2faa, sha1=af93 #endif $ f --quiet bar -DL 3 1 2 3 $ cd .. Yadda is a symlink $ f -qr dir -HB 17 dir: directory with 3 files (symlink !) dir: directory with 2 files (no-symlink !) dir/bar: 0000: 31 0a 32 0a 33 0a 34 0a 35 0a 36 0a 37 0a 38 0a |1.2.3.4.5.6.7.8.| 0010: 39 |9| dir/foo: 0000: 66 6f 6f 0a |foo.| dir/l: (symlink !) 0000: 79 61 64 64 61 |yadda| (symlink !)