Skip to content

Commit 02cf680

Browse files
committed
Update AppVeyor config and make package work on Windows
1 parent 6c693e0 commit 02cf680

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

.appveyor.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,25 @@ install:
1111
- bash -lc "pacman -U --noconfirm --config <(echo) msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz"
1212
# Kill gpg-agent due to bug in MSYS
1313
- TaskKill /IM gpg-agent.exe /F
14+
# Download and unpack zstd for win64 to unpack MSYS packages
15+
- appveyor DownloadFile https://github.com/facebook/zstd/releases/download/v1.4.8/zstd-v1.4.8-win64.zip
16+
- 7z e zstd-v1.4.8-win64.zip -ozstd -y
17+
# Download and install zstd for MSYS due to bug in MSYS
18+
- appveyor DownloadFile http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-zstd-1.4.8-2-any.pkg.tar.zst
19+
- zstd\zstd.exe -d mingw-w64-x86_64-zstd-1.4.8-2-any.pkg.tar.zst
20+
- dir
21+
- 7z a -tgzip mingw-w64-x86_64-zstd-1.4.8-2-any.pkg.tar.gz mingw-w64-x86_64-zstd-1.4.8-2-any.pkg.tar
22+
- bash -lc "cd /c/projects/python-tksvg; ls -l; pacman --noconfirm -U mingw-w64-x86_64-zstd-1.4.8-2-any.pkg.tar.gz"
23+
# Download and install pacman for MSYS due to bug in MSYS
24+
- appveyor DownloadFile http://repo.msys2.org/msys/x86_64/pacman-5.2.2-9-x86_64.pkg.tar.zst
25+
- 7z e zstd-v1.4.8-win64.zip -ozstd -y
26+
- zstd\zstd.exe -d pacman-5.2.2-9-x86_64.pkg.tar.zst
27+
- dir
28+
- 7z a -tgzip pacman-5.2.2-9-x86_64.pkg.tar.gz pacman-5.2.2-9-x86_64.pkg.tar
29+
- bash -lc "cd /c/projects/python-tksvg; ls -l; pacman --noconfirm --nodeps --nodeps -U pacman-5.2.2-9-x86_64.pkg.tar.gz"
30+
# Cleanup after bug workarounds
31+
- bash -lc "rm -rf zstd"
32+
- bash -lc "rm -rf *.tar *.zst"
1433
# Update known packages
1534
- bash -lc "pacman --needed --noconfirm -Syu"
1635
- bash -lc "pacman --needed --noconfirm -Sy"

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ ENDIF ( TTK_STUB_LIBRARY )
121121

122122
FILE ( WRITE tksvg/pkgIndex.tcl
123123
"package ifneeded tksvg ${PKG_VERSION} \\
124-
[list load [file join $dir lib${PKG_NAME}[info sharedlibextension]] tksvg]" )
124+
[list load [file join [pwd] lib${PKG_NAME}[info sharedlibextension]] tksvg]" )
125125

126126
SET ( LIBRARY_OUTPUT_PATH ${PKG_TARGET_LIB_NAME} )
127127
INSTALL ( TARGETS ${PKG_TARGET_LIB_NAME}

setup.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def run(self):
5353

5454
for dep in dependencies:
5555
printf("Installing dependency {}...".format(dep), end=" ")
56-
sp.call(["pacman", "--needed", "--noconfirm", "-S", "mingw-w64-x86_64-{}".format(dep)], stdout=sp.PIPE)
56+
sp.call(["pacman", "--needed", "--noconfirm", "-S", "mingw-w64-x86_64-{}".format(dep)]) # , stdout=sp.PIPE)
5757
printf("Done.")
5858
sp.call(["cmake", ".", "-G", "MinGW Makefiles"])
5959
sp.call(["mingw32-make"])
@@ -151,12 +151,16 @@ def copy_to_target(self, target: str):
151151
shutil.copyfile(p, t)
152152
else:
153153
printf("Copying {}".format(p))
154-
shutil.copyfile(p, os.path.join(target, os.path.basename(p)))
154+
target_file = os.path.join(target, os.path.basename(p))
155+
try:
156+
shutil.copyfile(p, target_file)
157+
except shutil.SameFileError:
158+
continue
155159

156160
specials={} # loaders.cache is used to specify abspaths to the loaders
157161
specials.update({"libpixbufloader-{}.dll".format(fmt): "/lib/gdk-pixbuf-2.0/2.10.0/loaders/"
158162
for fmt in ["ani", "bmp", "gif", "icns", "ico", "jpeg", "png", "pnm", "qtif", "svg", "tga", "tiff", "xbm", "xpm"]})
159-
DependencyWalker("libtksvg.dll", specials=specials).copy_to_target("tksvg")
163+
DependencyWalker("tksvg/libtksvg.dll", specials=specials).copy_to_target("tksvg")
160164
kwargs = {"package_data": {"tksvg": ["*.dll", "pkgIndex.tcl", "tksvg.tcl"] + ["{}/{}".format(dir.strip("/"), base) for base, dir in specials.items()]}}
161165

162166
else:

tksvg/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@ def load(window: tk.Tk):
2222
"""Load tksvg into a Tk interpreter"""
2323
local = os.path.abspath(os.path.dirname(__file__))
2424
with chdir(local):
25-
window.tk.eval("set dir {}".format(local))
2625
window.tk.eval("source pkgIndex.tcl")
2726
window.tk.eval("package require tksvg")

0 commit comments

Comments
 (0)