Skip to content

Commit

Permalink
Build fixes for windows (#2443)
Browse files Browse the repository at this point in the history
* few updates and build fixes for windows

* adding aioitertools

* avoiding ZoneInfo keys may not be absolute paths, got: /UTC

* fix the UTC issue
  • Loading branch information
k9ert authored May 22, 2024
1 parent 95c0678 commit d58232c
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 47 deletions.
10 changes: 9 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ before_script:
- python -V # Print out python version for debugging
- apt update
- apt install -y libusb-1.0-0-dev libudev-dev # usb-support in hidapi
# https://github.com/python-babel/babel/issues/990#issuecomment-1760326334
- rm -f /etc/localtime
- ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime
# This doesn't get cached in gitlab but we don't need it anyway for now:
# - ./tests/install_noded.sh --debug --elements compile
- pip3 install --upgrade virtualenv
Expand Down Expand Up @@ -111,6 +114,8 @@ release_binary_windows:
stage: releasing
only:
- tags
variables:
GIT_DEPTH: 0 # Disable shallow clone to get all Git history
tags:
- windows
before_script:
Expand Down Expand Up @@ -161,7 +166,10 @@ release_electron_linux_windows:
# Only difference to default befor_script: (ToDo fix this)
- python3 -m virtualenv --python=python3 .env
- source .env/bin/activate
- pip3 install -e ".[test]"
# https://github.com/python-babel/babel/issues/990#issuecomment-1760326334
- rm -f /etc/localtime
- ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime
- pip3 install -e ".[test]" # TZ=UTC because https://github.com/nektos/act/issues/1853
script:
- echo "Releasing for ${CI_PROJECT_ROOT_NAMESPACE}"
- export CI_PROJECT_ROOT_NAMESPACE # needed in the build-script to download the right windows-binary
Expand Down
5 changes: 0 additions & 5 deletions pyinstaller/build-win-ci.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@ call .\.buildenv\Scripts\activate
echo " --> Installing test-requirement"
pip3 install -e ".[test]"

echo " --> Setting version in setup.py"
python .\utils\release-helper.py set_setup_py_version %1%


echo " --> Building pypi package"
pip3 install build==0.10.0
python -m build

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

pip3 install -r pyinstaller/test_requirements.txt
cd pyinstaller

Rem This file gets further packaged up with the pyinstaller and will help specter to figure out which version it's running on
Expand Down
2 changes: 1 addition & 1 deletion pyinstaller/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ pyinstaller==5.2
pefile==2022.5.30
macholib
pywin32-ctypes
babel==2.10.1
babel==2.12.1
pytz==2022.1
18 changes: 9 additions & 9 deletions pyinstaller/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile --generate-hashes requirements.in
#
Expand All @@ -10,17 +10,19 @@ altgraph==0.17 \
# via
# macholib
# pyinstaller
babel==2.10.1 \
--hash=sha256:3f349e85ad3154559ac4930c3918247d319f21910d5ce4b25d439ed8693b98d2 \
--hash=sha256:98aeaca086133efb3e1e2aad0396987490c8425929ddbcfe0550184fdc54cd13
babel==2.12.1 \
--hash=sha256:b4246fb7677d3b98f501a39d43396d3cafdc8eadb045f4a31be01863f655c610 \
--hash=sha256:cc2d99999cd01d44420ae725a21c9e3711b3aadc7976d6147f622d8581963455
# via -r requirements.in
future==0.18.2 \
--hash=sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d
# via pefile
macholib==1.14 \
--hash=sha256:0c436bc847e7b1d9bda0560351bf76d7caf930fb585a828d13608839ef42c432 \
--hash=sha256:c500f02867515e6c60a27875b408920d18332ddf96b4035ef03beddd782d4281
# via -r requirements.in
# via
# -r requirements.in
# pyinstaller
pefile==2022.5.30 \
--hash=sha256:a5488a3dd1fd021ce33f969780b88fe0f7eebb76eb20996d7318f307612a045b
# via -r requirements.in
Expand All @@ -44,9 +46,7 @@ pyinstaller-hooks-contrib==2022.8 \
pytz==2022.1 \
--hash=sha256:1e760e2fe6a8163bc0b3d9a19c4f84342afa0a2affebfaa84b01b978a02ecaa7 \
--hash=sha256:e68985985296d9a66a881eb3193b0906246245294a881e7c8afe623866ac6a5c
# via
# -r requirements.in
# babel
# via -r requirements.in
pywin32-ctypes==0.2.0 \
--hash=sha256:24ffc3b341d457d48e8922352130cf2644024a4ff09762a2261fd34c36ee5942 \
--hash=sha256:9dc2d991b3479cc2df15930958b674a48a227d5361d413827a4cfd0b5876fc98
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[build-system]
requires = [
"setuptools<=65.7.0",
"setuptools_scm[toml]>=6.2",
"babel==2.11.0",
"setuptools_scm[toml]>=6.4.2",
"babel==2.12.1",
"build==0.10.0",
"wheel",
"twine"
Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ protobuf==3.20.2
PyJWT==2.4.0
pytimeparse==1.1.8
psycopg2-binary==2.9.5
aioitertools==0.11.0

# Extensions
cryptoadvance-liquidissuer==0.2.4
Expand Down
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#
# pip-compile --generate-hashes requirements.in
#
aioitertools==0.11.0 \
--hash=sha256:04b95e3dab25b449def24d7df809411c10e62aab0cbe31a50ca4e68748c43394 \
--hash=sha256:42c68b8dd3a69c2bf7f2233bf7df4bb58b557bca5252ac02ed5187bbc67d6831
# via -r requirements.in
aniso8601==9.0.1 \
--hash=sha256:1d2b7ef82963909e93c4f24ce48d4de9e66009a21bf1c1e1c85bdd0812fe412f \
--hash=sha256:72e3117667eedf66951bb2d93f4296a56b94b078a8a95905a052611fb3f1b973
Expand Down
47 changes: 18 additions & 29 deletions utils/release-helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import sys
import zipfile
from pathlib import Path
from glob import glob


logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.INFO)
Expand Down Expand Up @@ -340,36 +341,24 @@ def sha256sum(filenames):
# Used by build-win.ci.bat
sha256sum(sys.argv[2:])
exit(0)
if "set_setup_py_version" in sys.argv:
# Used by build-win.ci.bat
version = sys.argv[2]
print(f"setting version {version} in setup.py")
search_text = "vx.y.z-get-replaced-by-release-script"

# creating a variable and storing the text
# that we want to add
replace_text = version

# Opening our text file in read only
# mode using the open() function
with open(r"setup.py", "r") as file:
data = file.read()
data = data.replace(search_text, replace_text)
with open(r"setup.py", "w") as file:
file.write(data)
print("Done")
exit(0)
if "install_wheel" in sys.argv:
# Used by build-win.ci.bat
version = sys.argv[2]
version = version.replace("v", "")
version = version.replace("-pre", "rc")
filename = f"cryptoadvance.specter-{version}-py3-none-any.whl"
cmd = f"pip3 install {Path('dist',filename)}"
res = os.system(cmd)
print(f"result of command: {cmd}")
print(res)
exit(res)
# List all .whl files in the 'dist' directory
wheel_files = glob(
str(Path("dist", "cryptoadvance.specter-*-py3-none-any.whl"))
)
print("found those wheel files: " + str(wheel_files))

# Loop through the wheel files and install them
for wheel_file in wheel_files:
cmd = f"pip3 install {wheel_file}"
res = os.system(cmd)
print(f"Result of command: {cmd}")
print(res)
# If the installation fails, exit with the error code
if res != 0:
exit(res)
# Exit with a success code if all installations were successful
exit(0)

rh = ReleaseHelper()
rh.init_gitlab()
Expand Down

0 comments on commit d58232c

Please sign in to comment.