From cd3b5dacb1d471b1c1995d38755d31f9ce62a68f Mon Sep 17 00:00:00 2001 From: qa-soleil <qa-soleil@synchrotron-soleil.fr> Date: Fri, 12 May 2023 10:21:30 +0200 Subject: [PATCH] Add python script to build Conan package for Windows 7 --- .gitignore | 1 + README.md | 19 ++++++++++++++++++- build-windows-i386.py | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 build-windows-i386.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c795b05 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build \ No newline at end of file diff --git a/README.md b/README.md index 28a91c4..3f2e774 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,24 @@ # Conan -Pipeline to create Conan package +## Pipeline to create Conan package for Linux Conan 2.0.4 for: * Linux 32 bits: [conan-2.0.4-linux-i686.zip](https://gitlab.synchrotron-soleil.fr/software-control-system/devtools/conan/-/jobs/artifacts/2.0.4/download?job=linux-i686) * Linux 64 bits: [conan-2.0.4-linux-x86_64.zip](https://gitlab.synchrotron-soleil.fr/software-control-system/devtools/git/-/jobs/artifacts/2.0.4/download?job=linux-x86_64) + +## Python script to create Conan package for Windows 32 bits + +The script `build-windows-i386.py` allows to build Conan package for Windows 7 32 bits. + +Prerequisites on path on the build host: +* Python +* Git + +To launch build: +``` +python build-windows-i386.py +``` + +The build deliveries the archive `build\conan-2.0.4-windows-i386.zip` + +Tested with python 3.7 on Windows 7 32 bits. Warning, it is mandatory to use installed version python on Windows 7 to include all dll in package with PytInstaller. diff --git a/build-windows-i386.py b/build-windows-i386.py new file mode 100644 index 0000000..76deeab --- /dev/null +++ b/build-windows-i386.py @@ -0,0 +1,34 @@ +import os +import subprocess +import urllib.request +import shutil + +CONAN_VERSION = '2.0.4' + +CONAN_ROOT = os.path.dirname(os.path.abspath(__file__)) + +# Remove and recreate build directory +BUILD_DIR=os.path.join(CONAN_ROOT, 'build') +os.system(f"rmdir /s /q {BUILD_DIR} > nul 2>&1") +os.makedirs(BUILD_DIR) +os.chdir(BUILD_DIR) + +# Build Conan with PyInstaller +conan_dir = os.path.join(BUILD_DIR, 'conan_src') +subprocess.check_call(['git', 'clone', 'https://github.com/conan-io/conan', conan_dir]) +subprocess.check_call(['git', 'checkout', CONAN_VERSION], cwd=conan_dir) +subprocess.check_call(['pip', 'install', '-e', conan_dir]) +subprocess.check_call(['python', 'pyinstaller.py'], cwd=conan_dir) +conan_exe = os.path.join(conan_dir, 'pyinstaller', 'dist', 'conan', 'conan.exe') +subprocess.check_call([conan_exe, '--version']) + +# Add Sectigo CA certificates to Conan CA certificates +cacert_sectigo=os.path.join(CONAN_ROOT, 'conan_synchrotron-soleil_fr_interm.cer') +cacert=os.path.join(conan_dir, 'pyinstaller', 'dist', 'conan', 'certifi', 'cacert.pem') +with open(cacert_sectigo, 'r') as f1: + with open(cacert, 'a') as f2: + f2.write(f1.read()) + +# Make archive +shutil.make_archive(os.path.join(BUILD_DIR, f'conan-{CONAN_VERSION}-windows-i386'), 'zip', + os.path.join(conan_dir, 'pyinstaller', 'dist', 'conan')) -- GitLab