Skip to content

Commit d58232c

Browse files
author
k9ert
authored
Build fixes for windows (#2443)
* few updates and build fixes for windows * adding aioitertools * avoiding ZoneInfo keys may not be absolute paths, got: /UTC * fix the UTC issue
1 parent 95c0678 commit d58232c

File tree

8 files changed

+44
-47
lines changed

8 files changed

+44
-47
lines changed

.gitlab-ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ before_script:
2828
- python -V # Print out python version for debugging
2929
- apt update
3030
- apt install -y libusb-1.0-0-dev libudev-dev # usb-support in hidapi
31+
# https://github.com/python-babel/babel/issues/990#issuecomment-1760326334
32+
- rm -f /etc/localtime
33+
- ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime
3134
# This doesn't get cached in gitlab but we don't need it anyway for now:
3235
# - ./tests/install_noded.sh --debug --elements compile
3336
- pip3 install --upgrade virtualenv
@@ -111,6 +114,8 @@ release_binary_windows:
111114
stage: releasing
112115
only:
113116
- tags
117+
variables:
118+
GIT_DEPTH: 0 # Disable shallow clone to get all Git history
114119
tags:
115120
- windows
116121
before_script:
@@ -161,7 +166,10 @@ release_electron_linux_windows:
161166
# Only difference to default befor_script: (ToDo fix this)
162167
- python3 -m virtualenv --python=python3 .env
163168
- source .env/bin/activate
164-
- pip3 install -e ".[test]"
169+
# https://github.com/python-babel/babel/issues/990#issuecomment-1760326334
170+
- rm -f /etc/localtime
171+
- ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime
172+
- pip3 install -e ".[test]" # TZ=UTC because https://github.com/nektos/act/issues/1853
165173
script:
166174
- echo "Releasing for ${CI_PROJECT_ROOT_NAMESPACE}"
167175
- export CI_PROJECT_ROOT_NAMESPACE # needed in the build-script to download the right windows-binary

pyinstaller/build-win-ci.bat

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,13 @@ call .\.buildenv\Scripts\activate
1414
echo " --> Installing test-requirement"
1515
pip3 install -e ".[test]"
1616

17-
echo " --> Setting version in setup.py"
18-
python .\utils\release-helper.py set_setup_py_version %1%
19-
20-
2117
echo " --> Building pypi package"
2218
pip3 install build==0.10.0
2319
python -m build
2420

2521
echo " --> Installing pypi package"
2622
python .\utils\release-helper.py install_wheel %1%
2723

28-
pip3 install -r pyinstaller/test_requirements.txt
2924
cd pyinstaller
3025

3126
Rem This file gets further packaged up with the pyinstaller and will help specter to figure out which version it's running on

pyinstaller/requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ pyinstaller==5.2
22
pefile==2022.5.30
33
macholib
44
pywin32-ctypes
5-
babel==2.10.1
5+
babel==2.12.1
66
pytz==2022.1

pyinstaller/requirements.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#
2-
# This file is autogenerated by pip-compile with python 3.10
3-
# To update, run:
2+
# This file is autogenerated by pip-compile with Python 3.10
3+
# by the following command:
44
#
55
# pip-compile --generate-hashes requirements.in
66
#
@@ -10,17 +10,19 @@ altgraph==0.17 \
1010
# via
1111
# macholib
1212
# pyinstaller
13-
babel==2.10.1 \
14-
--hash=sha256:3f349e85ad3154559ac4930c3918247d319f21910d5ce4b25d439ed8693b98d2 \
15-
--hash=sha256:98aeaca086133efb3e1e2aad0396987490c8425929ddbcfe0550184fdc54cd13
13+
babel==2.12.1 \
14+
--hash=sha256:b4246fb7677d3b98f501a39d43396d3cafdc8eadb045f4a31be01863f655c610 \
15+
--hash=sha256:cc2d99999cd01d44420ae725a21c9e3711b3aadc7976d6147f622d8581963455
1616
# via -r requirements.in
1717
future==0.18.2 \
1818
--hash=sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d
1919
# via pefile
2020
macholib==1.14 \
2121
--hash=sha256:0c436bc847e7b1d9bda0560351bf76d7caf930fb585a828d13608839ef42c432 \
2222
--hash=sha256:c500f02867515e6c60a27875b408920d18332ddf96b4035ef03beddd782d4281
23-
# via -r requirements.in
23+
# via
24+
# -r requirements.in
25+
# pyinstaller
2426
pefile==2022.5.30 \
2527
--hash=sha256:a5488a3dd1fd021ce33f969780b88fe0f7eebb76eb20996d7318f307612a045b
2628
# via -r requirements.in
@@ -44,9 +46,7 @@ pyinstaller-hooks-contrib==2022.8 \
4446
pytz==2022.1 \
4547
--hash=sha256:1e760e2fe6a8163bc0b3d9a19c4f84342afa0a2affebfaa84b01b978a02ecaa7 \
4648
--hash=sha256:e68985985296d9a66a881eb3193b0906246245294a881e7c8afe623866ac6a5c
47-
# via
48-
# -r requirements.in
49-
# babel
49+
# via -r requirements.in
5050
pywin32-ctypes==0.2.0 \
5151
--hash=sha256:24ffc3b341d457d48e8922352130cf2644024a4ff09762a2261fd34c36ee5942 \
5252
--hash=sha256:9dc2d991b3479cc2df15930958b674a48a227d5361d413827a4cfd0b5876fc98

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[build-system]
22
requires = [
33
"setuptools<=65.7.0",
4-
"setuptools_scm[toml]>=6.2",
5-
"babel==2.11.0",
4+
"setuptools_scm[toml]>=6.4.2",
5+
"babel==2.12.1",
66
"build==0.10.0",
77
"wheel",
88
"twine"

requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ protobuf==3.20.2
2828
PyJWT==2.4.0
2929
pytimeparse==1.1.8
3030
psycopg2-binary==2.9.5
31+
aioitertools==0.11.0
3132

3233
# Extensions
3334
cryptoadvance-liquidissuer==0.2.4

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
#
55
# pip-compile --generate-hashes requirements.in
66
#
7+
aioitertools==0.11.0 \
8+
--hash=sha256:04b95e3dab25b449def24d7df809411c10e62aab0cbe31a50ca4e68748c43394 \
9+
--hash=sha256:42c68b8dd3a69c2bf7f2233bf7df4bb58b557bca5252ac02ed5187bbc67d6831
10+
# via -r requirements.in
711
aniso8601==9.0.1 \
812
--hash=sha256:1d2b7ef82963909e93c4f24ce48d4de9e66009a21bf1c1e1c85bdd0812fe412f \
913
--hash=sha256:72e3117667eedf66951bb2d93f4296a56b94b078a8a95905a052611fb3f1b973

utils/release-helper.py

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import sys
77
import zipfile
88
from pathlib import Path
9+
from glob import glob
910

1011

1112
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.INFO)
@@ -340,36 +341,24 @@ def sha256sum(filenames):
340341
# Used by build-win.ci.bat
341342
sha256sum(sys.argv[2:])
342343
exit(0)
343-
if "set_setup_py_version" in sys.argv:
344-
# Used by build-win.ci.bat
345-
version = sys.argv[2]
346-
print(f"setting version {version} in setup.py")
347-
search_text = "vx.y.z-get-replaced-by-release-script"
348-
349-
# creating a variable and storing the text
350-
# that we want to add
351-
replace_text = version
352-
353-
# Opening our text file in read only
354-
# mode using the open() function
355-
with open(r"setup.py", "r") as file:
356-
data = file.read()
357-
data = data.replace(search_text, replace_text)
358-
with open(r"setup.py", "w") as file:
359-
file.write(data)
360-
print("Done")
361-
exit(0)
362344
if "install_wheel" in sys.argv:
363-
# Used by build-win.ci.bat
364-
version = sys.argv[2]
365-
version = version.replace("v", "")
366-
version = version.replace("-pre", "rc")
367-
filename = f"cryptoadvance.specter-{version}-py3-none-any.whl"
368-
cmd = f"pip3 install {Path('dist',filename)}"
369-
res = os.system(cmd)
370-
print(f"result of command: {cmd}")
371-
print(res)
372-
exit(res)
345+
# List all .whl files in the 'dist' directory
346+
wheel_files = glob(
347+
str(Path("dist", "cryptoadvance.specter-*-py3-none-any.whl"))
348+
)
349+
print("found those wheel files: " + str(wheel_files))
350+
351+
# Loop through the wheel files and install them
352+
for wheel_file in wheel_files:
353+
cmd = f"pip3 install {wheel_file}"
354+
res = os.system(cmd)
355+
print(f"Result of command: {cmd}")
356+
print(res)
357+
# If the installation fails, exit with the error code
358+
if res != 0:
359+
exit(res)
360+
# Exit with a success code if all installations were successful
361+
exit(0)
373362

374363
rh = ReleaseHelper()
375364
rh.init_gitlab()

0 commit comments

Comments
 (0)