Skip to content

Commit 258efa4

Browse files
committed
Revert partially: fix install on Windows
1 parent da5b330 commit 258efa4

2 files changed

Lines changed: 16 additions & 13 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
6969
7070
build-wheels:
71-
name: Build ${{ matrix.only }}
71+
name: build ${{ matrix.only }}
7272
needs: build-wheels-matrix
7373
runs-on: ${{ matrix.os }}
7474

add_libmagic.sh

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@ install_source() {
66
# install from source
77
# https://www.darwinsys.com/file/
88
# https://github.com/file/file/blob/FILE5_45/INSTALL#L51
9-
version="file-5.45" &&
10-
tmpfile="$(mktemp)" &&
11-
curl -sSLo "${tmpfile}" "https://astron.com/pub/file/${version}.tar.gz" &&
12-
tar xvf "${tmpfile}" &&
13-
cd "${version}" &&
14-
./configure &&
15-
make &&
16-
make install &&
17-
make installcheck &&
18-
cd .. &&
19-
rm -r "${version}"
9+
(
10+
version="file-5.45" &&
11+
tmpfile="$(mktemp)" &&
12+
curl -sSLo "${tmpfile}" "https://astron.com/pub/file/${version}.tar.gz" &&
13+
tar xvf "${tmpfile}" &&
14+
cd "${version}" &&
15+
./configure &&
16+
make &&
17+
make install &&
18+
make installcheck &&
19+
cd .. &&
20+
rm -r "${version}"
21+
) || ( cd .. && false )
2022
}
2123

2224
install_precompiled() {
@@ -37,6 +39,7 @@ install_precompiled() {
3739
else
3840
# windows (no install, just download into current working directory)
3941
# could also consider install using `pacman`: https://packages.msys2.org/base/mingw-w64-file
42+
# which would require an update of copy_libmagic below to account for new magic.mgc paths
4043
python <<EOF
4144
import platform, sysconfig, io, zipfile, urllib.request
4245
assert platform.system() == "Windows"
@@ -56,7 +59,7 @@ copy_libmagic() {
5659
# this python command relies on current working directory containing `./magic/loader.py`
5760
libmagic_path="$(python -c 'from magic.loader import load_lib; print(load_lib()._name)')" &&
5861
cp "${libmagic_path}" "magic" &&
59-
# only on linux: additionally copy compiled db into magic dir (prefer the one installed by install_source)
62+
# only on linux/macos: additionally copy compiled db into magic dir (prefer the one installed by install_source)
6063
( ( cp "/usr/local/share/misc/magic.mgc" "magic" || cp "/usr/share/misc/magic.mgc" "magic" ) || true ) &&
6164
# check what was copied
6265
ls -ltra magic

0 commit comments

Comments
 (0)