Skip to content
Snippets Groups Projects
Commit cd3b5dac authored by qa-soleil's avatar qa-soleil :sun_with_face:
Browse files

Add python script to build Conan package for Windows 7

parent 8a73f4eb
No related branches found
No related tags found
No related merge requests found
build
\ No newline at end of file
# 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.
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'))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment