From d58232c582e09931a30c5e950b0b4187e34425de Mon Sep 17 00:00:00 2001 From: k9ert Date: Wed, 22 May 2024 14:54:41 +0200 Subject: [PATCH] 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 --- .gitlab-ci.yml | 10 +++++++- pyinstaller/build-win-ci.bat | 5 ---- pyinstaller/requirements.in | 2 +- pyinstaller/requirements.txt | 18 +++++++------- pyproject.toml | 4 +-- requirements.in | 1 + requirements.txt | 4 +++ utils/release-helper.py | 47 ++++++++++++++---------------------- 8 files changed, 44 insertions(+), 47 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ae732b2898..66fb415fd7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 @@ -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: @@ -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 diff --git a/pyinstaller/build-win-ci.bat b/pyinstaller/build-win-ci.bat index d13ad0159e..4c5655911f 100755 --- a/pyinstaller/build-win-ci.bat +++ b/pyinstaller/build-win-ci.bat @@ -14,10 +14,6 @@ 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 @@ -25,7 +21,6 @@ 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 diff --git a/pyinstaller/requirements.in b/pyinstaller/requirements.in index ffc6f7735b..aa002f1737 100644 --- a/pyinstaller/requirements.in +++ b/pyinstaller/requirements.in @@ -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 diff --git a/pyinstaller/requirements.txt b/pyinstaller/requirements.txt index 33bda39fe3..2c94e1649a 100644 --- a/pyinstaller/requirements.txt +++ b/pyinstaller/requirements.txt @@ -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 # @@ -10,9 +10,9 @@ 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 @@ -20,7 +20,9 @@ future==0.18.2 \ 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 @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 819fe98773..7a477e19ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/requirements.in b/requirements.in index b69ec47514..0d2aeb9977 100644 --- a/requirements.in +++ b/requirements.in @@ -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 diff --git a/requirements.txt b/requirements.txt index f358028af0..88b12f086f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/utils/release-helper.py b/utils/release-helper.py index 8231e68f42..fd9f5bf14d 100644 --- a/utils/release-helper.py +++ b/utils/release-helper.py @@ -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) @@ -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()