Skip to content

Commit 01b493e

Browse files
committed
pymol: fix launch script handling
* Prevent hardcoded paths in pymol.bat launcher Signed-off-by: Zhou Qiankang <[email protected]>
1 parent 49212c9 commit 01b493e

File tree

3 files changed

+72
-6
lines changed

3 files changed

+72
-6
lines changed

mingw-w64-pymol/PKGBUILD

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ _realname=pymol
44
pkgbase=mingw-w64-${_realname}
55
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
66
pkgver=3.1.0
7-
pkgrel=1
7+
pkgrel=2
88
pkgdesc="Molecular visualization system on an Open Source foundation (mingw-w64)"
99
arch=(any)
1010
mingw_arch=('ucrt64' 'clang64' 'clangarm64')
@@ -34,14 +34,18 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
3434
options=('!strip')
3535
_archive="pymol-open-source-$pkgver"
3636
source=("$_url/archive/v$pkgver/$_archive.tar.gz"
37-
"support-to-build-pymol-with-mingw-w64.patch")
37+
"support-to-build-pymol-with-mingw-w64.patch"
38+
"fix-update-launch-script-handling-for-mingw-w64-msys.patch")
3839
sha256sums=('54306d65060bd58ed8b3dab1a8af521aeb4fd417871f15f463ff05ccb4e121fe'
39-
'52ee00040581e82a7c090c80082125994345d250b8ad0b16b87ac611d6297cf9')
40+
'784e2f29c73cd361a80b5c0ea14b8ca2820b19ffaefe37ad138bb567a8c802b5'
41+
'8f0aa54849bfbd3b738a93fa4ffdc875e07bfdbb58eaaf0de8950b14c3b8336f')
4042

4143
prepare() {
4244
cd "${_archive}"
4345
# Backport https://github.com/schrodinger/pymol-open-source/pull/486
4446
patch -Np1 -i "${srcdir}/support-to-build-pymol-with-mingw-w64.patch"
47+
# Backport https://github.com/schrodinger/pymol-open-source/pull/487
48+
patch -Np1 -i "${srcdir}/fix-update-launch-script-handling-for-mingw-w64-msys.patch"
4549
# unpin over-aggressive dependency pinning
4650
sed -i -e '/numpy/s/>.*"/"/g' pyproject.toml
4751
# avoid duplicate binary creation
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
From cea1d914003fdac072ac48f87e1a2d06adbc6eb4 Mon Sep 17 00:00:00 2001
2+
From: Zhou Qiankang <[email protected]>
3+
Date: Wed, 10 Dec 2025 12:30:00 +0800
4+
Subject: [PATCH] fix: update launch script handling for mingw-w64/msys2 on
5+
Windows
6+
7+
Signed-off-by: Zhou Qiankang <[email protected]>
8+
---
9+
setup.py | 35 ++++++++++++++++++++---------------
10+
1 file changed, 20 insertions(+), 15 deletions(-)
11+
12+
diff --git a/setup.py b/setup.py
13+
index a75045eb..aba651bd 100644
14+
--- a/setup.py
15+
+++ b/setup.py
16+
@@ -508,23 +508,28 @@ class install_pymol(install):
17+
18+
with open(launch_script, "w") as out:
19+
if WIN:
20+
- # paths relative to launcher, if possible
21+
- try:
22+
- python_exe = "%~dp0\\" + os.path.relpath(
23+
- python_exe, self.install_scripts
24+
- )
25+
- except ValueError:
26+
- pass
27+
- try:
28+
- pymol_file = "%~dp0\\" + os.path.relpath(
29+
- pymol_file, self.install_scripts
30+
- )
31+
- except ValueError:
32+
- pymol_file = os.path.abspath(pymol_file)
33+
-
34+
if not self.pymol_path_is_default:
35+
out.write(f"set PYMOL_PATH={pymol_path}" + os.linesep)
36+
- out.write('"%s" "%s"' % (python_exe, pymol_file))
37+
+
38+
+ if is_mingw:
39+
+ python_exe = "%~dp0\\python.exe"
40+
+ out.write('"%s" -m pymol' % python_exe)
41+
+ else:
42+
+ # paths relative to launcher, if possible
43+
+ try:
44+
+ python_exe = "%~dp0\\" + os.path.relpath(
45+
+ python_exe, self.install_scripts
46+
+ )
47+
+ except ValueError:
48+
+ pass
49+
+ try:
50+
+ pymol_file = "%~dp0\\" + os.path.relpath(
51+
+ pymol_file, self.install_scripts
52+
+ )
53+
+ except ValueError:
54+
+ pymol_file = os.path.abspath(pymol_file)
55+
+ out.write('"%s" "%s"' % (python_exe, pymol_file))
56+
+
57+
out.write(" %*" + os.linesep)
58+
else:
59+
out.write("#!/bin/sh" + os.linesep)
60+
--
61+
2.50.1.windows.1
62+

mingw-w64-pymol/support-to-build-pymol-with-mingw-w64.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From 3d09924d3b6c1bcdbb427d4c566bbdd155204ba3 Mon Sep 17 00:00:00 2001
1+
From 0727afbc914a0230333e83ff9ae1c9cd6100d880 Mon Sep 17 00:00:00 2001
22
From: Zhou Qiankang <[email protected]>
33
Date: Sun, 23 Nov 2025 11:56:46 +0800
44
Subject: [PATCH] build: support to build pymol with mingw-w64 on Windows
@@ -65,7 +65,7 @@ index 470733852..632f52877 100644
6565
typedef unsigned __int64 ov_uint64;
6666
#else
6767
diff --git a/setup.py b/setup.py
68-
index ec7237a86..09d0743bf 100644
68+
index ec7237a86..a75045eb1 100644
6969
--- a/setup.py
7070
+++ b/setup.py
7171
@@ -31,6 +31,13 @@
@@ -75,7 +75,7 @@ index ec7237a86..09d0743bf 100644
7575
+# check for mingw compiler on windows
7676
+is_mingw = False
7777
+if WIN:
78-
+ from distutils import ccompiler
78+
+ from setuptools._distutils import ccompiler
7979
+ is_mingw = ccompiler.get_default_compiler() == 'mingw32'
8080
+
8181
+

0 commit comments

Comments
 (0)