Skip to content

Commit

Permalink
replaced Windows build script with Docker-based script from jpylyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsgalore committed Apr 13, 2022
1 parent f8422ca commit e7d78fa
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 138 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
*.md.html
bin
.pydevproject

# Cache dirs
#################
__pycache__
.pytest_cache
# Netbeans Files #
#################
nbactions.xml
Expand Down
136 changes: 0 additions & 136 deletions buildwin.sh

This file was deleted.

43 changes: 43 additions & 0 deletions docker-package-win.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#! /usr/bin/env bash
#
# Build Debian package in a Docker container
#
SCRIPT_DIR="$( dirname "$( readlink -f "${BASH_SOURCE[0]}" )")"
DIST_DIR="${SCRIPT_DIR}/dist"
WIN_DIST_DIR="${DIST_DIR}/windows"
set -e

# Get build platform as 1st argument, and collect project metadata
pypi_name="$(./setup.py --name)"
pypi_version="$(./setup.py --version)"
pkgname=$pypi_name

function buildAndPackage(){
# Installs Python. Arguments:
# - $1: docker image tag (python3 or python3-32bit)
# - $2: Windows zip package suffix

# Set zip package name
zip_name="${DIST_DIR}/${pkgname}_${pypi_version}_${2}.zip"

# Remove the windows dist directoruy if it exists
[ -d ${WIN_DIST_DIR} ] && rm -rf ${WIN_DIST_DIR}
# Remove any existing zip package
[ -e ${zip_name} ] && rm ${zip_name}

# Run the appropriate docker machine (python3-32bit for win32)
# --rm Clean up docker container after execution:
# https://docs.docker.com/engine/reference/run/#clean-up---rm
# -v "$(pwd):/src/" Map working directory to container /src:
# https://docs.docker.com/engine/reference/run/#volume-shared-filesystems
docker run -v "$(pwd):/src/" --rm "cdrx/pyinstaller-windows:${1}" "/entrypoint.sh && chown $(id -u):$(id -g) -R /src/dist"

# Zip up the package and clean up
cd "${WIN_DIST_DIR}"
zip -r ${zip_name} ${pkgname}
cd ${SCRIPT_DIR}
[ -d ${WIN_DIST_DIR} ] && rm -rf ${WIN_DIST_DIR}
}

buildAndPackage python3-32bit win32
buildAndPackage python3 win64
2 changes: 1 addition & 1 deletion setup.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
"""Setup script for isolyzer"""
import codecs
import os
Expand Down

0 comments on commit e7d78fa

Please sign in to comment.