Skip to content

Commit b3e40e3

Browse files
committed
Add Calculix, update to Py3.12.4, Qt6.7.2
1 parent 3b58f65 commit b3e40e3

File tree

3 files changed

+47
-12
lines changed

3 files changed

+47
-12
lines changed

compile_all.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ def get_cmake_options(self) -> List[str]:
178178
f"-D ZLIB_INCLUDE_DIR={self.install_dir}/include",
179179
f"-D ZLIB_LIBRARY_RELEASE={self.install_dir}/lib/zlib" + to_static(),
180180
f"-D ZLIB_LIBRARY_DEBUG={self.install_dir}/lib/zlibd" + to_static(),
181-
"-D CMAKE_DISABLE_FIND_PACKAGE_SoQt=True", # Absolutely never find SoQt (it's deprecated and we don't want it!)
181+
"-D CMAKE_DISABLE_FIND_PACKAGE_SoQt=True",
182+
# Absolutely never find SoQt (it's deprecated and we don't want it!)
182183
]
183184
if self.boost_include_path:
184185
base.append(f"-D Boost_INCLUDE_DIR={self.boost_include_path}")
@@ -1018,3 +1019,11 @@ def build_opencamlib(self, _: None):
10181019
return
10191020
extra_args = ["-D BUILD_CXX_LIB=ON -D BUILD_PY_LIB=ON -D BUILD_DOC=OFF"]
10201021
self._build_standard_cmake(extra_args)
1022+
1023+
def build_calculix(self, _: None):
1024+
"""Cannot currently build Calculix (it's in Fortran, and we only support MSVC toolchain right now). Extract
1025+
the relevant files from the downloaded zipfile and copy them"""
1026+
path_to_ccx_bin = os.path.join(os.getcwd(), "CL35-win64", "bin", "ccx", "218")
1027+
if not os.path.exists(path_to_ccx_bin):
1028+
raise RuntimeError("Could not locate Calculix")
1029+
shutil.copytree(path_to_ccx_bin, os.path.join(self.install_dir, "bin"), dirs_exist_ok=True)

config.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
{
66
"name":"python",
77
"git-repo":"https://github.com/python/cpython.git",
8-
"git-ref":"v3.12.3"
8+
"git-ref":"v3.12.4"
99
},
1010
{
1111
"name":"pip",
12-
"note":"Use the ensure_pip Python module to install pip after compiling Python"
12+
"note":"Uses the ensure_pip Python module to install pip after compiling Python"
1313
},
1414
{
1515
"name":"setuptools",
@@ -62,7 +62,7 @@
6262
},
6363
{
6464
"name":"qt",
65-
"install-directory":"C:\\Qt\\6.7.1\\msvc2019_64"
65+
"install-directory":"C:\\Qt\\6.7.2\\msvc2019_64"
6666
},
6767
{
6868
"name":"bzip2",
@@ -113,7 +113,7 @@
113113
{
114114
"name":"pyside",
115115
"git-repo": "http://code.qt.io/pyside/pyside-setup",
116-
"git-ref": "v6.7.1"
116+
"git-ref": "v6.7.2"
117117
},
118118
{
119119
"name":"vtk",
@@ -207,6 +207,11 @@
207207
"name": "opencamlib",
208208
"git-repo": "https://github.com/aewallin/opencamlib",
209209
"git-ref": "2023.01.11"
210+
},
211+
{
212+
"name":"calculix",
213+
"url":"https://drive.usercontent.google.com/download?id=1Z8Mnx9-tyPdPlRi9kdPkFqZhTVA1uemY&export=download&authuser=0&confirm=t&uuid=1808e0cb-38d9-43ea-beea-619109a11527&at=APZUnTWlTXR23jpMPcF6-LBcbOaN:1720405069050",
214+
"note":"Difficult to compile with an MSVC toolchain because it is written in Fortran. Direct download link here is from http://calculixforwin.blogspot.com/2015/05/calculix-launcher.html"
210215
}
211216
]
212217
}

create_libpack.py

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import shutil
3232
import stat
3333
import subprocess
34+
import tarfile
3435
from urllib.parse import urlparse
3536
import path_cleaner
3637

@@ -155,7 +156,8 @@ def clone(name: str, url: str, ref: str = None):
155156

156157

157158
def download(name: str, url: str):
158-
"""Directly downloads some sort of compressed format file and decompresses it using a system-installed 7-zip"""
159+
"""Directly downloads some sort of compressed format file and decompresses it (either using an internal
160+
python method, or using a system-installed 7-zip)"""
159161
print(f"Downloading {name} from {url}")
160162
os.mkdir(name)
161163
request_result = requests.get(url)
@@ -169,12 +171,31 @@ def download(name: str, url: str):
169171
def decompress(name: str, filename: str):
170172
original_dir = os.getcwd()
171173
os.chdir(name)
172-
try:
173-
subprocess.run([path_to_7zip, "x", filename], capture_output=True, check=True)
174-
except subprocess.CalledProcessError as e:
175-
print("ERROR: failed to unzip {filename} at from {name} using {path_to_7zip}")
176-
print(e.output)
177-
exit(e.returncode)
174+
if filename.endswith("7z") or filename.endswith("7zip"):
175+
try:
176+
subprocess.run([path_to_7zip, "x", filename], capture_output=True, check=True)
177+
except subprocess.CalledProcessError as e:
178+
print("ERROR: failed to unzip {filename} at from {name} using {path_to_7zip}")
179+
print(e.output)
180+
exit(e.returncode)
181+
elif (
182+
filename.endswith(".tar.gz")
183+
or filename.endswith(".tar.bz2")
184+
or filename.endswith(".tar.xz")
185+
):
186+
try:
187+
with tarfile.open(filename) as f:
188+
f.extractall(filter="data")
189+
except tarfile.TarError as e:
190+
print(e)
191+
exit(1)
192+
else: # Try to use 7-zip to see if it's something understandable to that program
193+
try:
194+
subprocess.run([path_to_7zip, "x", filename], capture_output=True, check=True)
195+
except subprocess.CalledProcessError as e:
196+
print("ERROR: failed to unzip {filename} at from {name} using {path_to_7zip}")
197+
print(e.output)
198+
exit(e.returncode)
178199
os.chdir(original_dir)
179200

180201

0 commit comments

Comments
 (0)