Skip to content

Commit

Permalink
FEAT - All Docker packaging
Browse files Browse the repository at this point in the history
- added new `docker-package-pypi.sh` script for Docker based `twine` upload;
- changes to `package-pypi.sh` for Docker use:
  - needs to run in script dir for Docker;
  - use explicit config file for credentials;
  - added `twine` installation via `pip`;
- `docker-package-win.sh` now uses `cdrx/pyinstaller-windows` Docker image for Wine and Windows Python packaging;
- added new `jpylyzer.spec` suitable for win32 and win64 builds, these are now controlled via Docker image choice;
- added `requirements.txt` for automatic installation of `six` when building windows packages;
- updated packaging documentation;
- enabled long description in `setup.py`;
- added `realpath` installation to `.travis.yml`;
- removed unneeded `Dockerfile-Wine.build`, `buildwin.sh`, `jpylyzer_win32.spec`, `jpylyzer_win64.spec`;
- small `README.md` tweaks; and
- tidied `.travis.yml`.
  • Loading branch information
carlwilson committed Nov 21, 2019
1 parent 5f0594a commit e1fa44f
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 333 deletions.
12 changes: 3 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@ services:
- docker

before_install:
- sudo apt-get install -y realpath
- python --version
- pip install -U pip
- pip install -U pytest
- pip install -U pyinstaller
- pip install -U pep257
- pip install -U twine
- pip install -U codacy-coverage
- pip install -U pip pytest pyinstaller pep257 twine codacy-coverage
# Make the Jpylyzer test files available by cloning the repo as a sibling directory
- git clone https://github.com/openpreserve/jpylyzer-test-files.git ../jpylyzer-test-files

Expand Down Expand Up @@ -49,9 +45,7 @@ script:
- ./setup.py sdist
- twine check dist/*
- ./docker-package.sh debian:stretch
- ./docker-package-win.sh debian:stretch
# DISABLED - to make way for debian packaging above
# - ./build-with-pyinstaller.sh
- ./docker-package-win.sh

after_success:
- ls -alh ./dist
Expand Down
49 changes: 22 additions & 27 deletions BUILD_HOWTO_WINDOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,28 @@

## Prerequisites

Windows binaries are now built under Linux using [Wine](https://www.winehq.org/). Make sure you have a recent version of Wine installed. Also check if (a recent version of) the *winbind* package is installed. If not, install it using:

sudo apt-get install winbind

The windows packaging is now Docker based. In order to run Docker as a non-root user, it is helpful to create a Unix *docker* group. Steps (see also the more detailed discussion [here](https://docs.docker.com/install/linux/linux-postinstall/)):

1. Create the *docker* group:
```
sudo groupadd docker
```
1. Add the current user to the group:
```
sudo usermod -aG docker $USER
```
1. Then log out and then log back in for the changes to take effect, or run the following command:
```
newgrp docker
```
1. Verify that everything works by running the following test:
```
docker run hello-world
```
## Building the binaries
In your console window, go to the root of the jpylyzer directory. Then run:

./buildwin.sh

The script first checks for the presence of (portable) 64 and 32 versions of Python 2.7 under *Wine*, and installs them if they are not found. Note that the installers need some manual input. Most importantly, make sure you enter the following installation paths:

* `C:\Python27_64` for the 64-bit version;

* `C:\Python27_32` for the 32-bit version.

The script also automatically installs PyInstaller ifit is not there already.

Once the above dependencies are installed, 64 and 32 bit binaries are built automatically. The (zipped) binaries can be found in the *dist* directory.

## Troubleshooting

If the output of the build script includes this error:

err:winediag:SECUR32_initNTLMSP ntlm_auth was not found or is outdated. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your distribution.

Fix this by installing *winbind* (see the top of this page).



```
./docker-package-win.sh
```
The (zipped) binaries can be found in the `dist` directory.
53 changes: 0 additions & 53 deletions Dockerfile-Wine.build

This file was deleted.

8 changes: 0 additions & 8 deletions Makefile

This file was deleted.

9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ Please visit the jpylyzer homepage for links to the most recent package download
<http://jpylyzer.openpreservation.org/>


## Cd Status
## CI Status

- [![Build Status](https://travis-ci.org/openpreserve/jpylyzer.svg?branch=master)](https://travis-ci.org/openpreserve/jpylyzer "Jpylyzer Travis-CI integration build") Travis-CI

- [![Build Status](http://jenkins.opf-labs.org/buildStatus/icon?job=jpylyser)](http://jenkins.opf-labs.org/job/jpylyser/) OPF Jenkins

- [![Build Status](https://jenkins.openpreservation.org/buildStatus/icon?job=jpylyzer%2Fjpylyzer)](https://jenkins.openpreservation.org/job/jpylyzer/job/jpylyzer/) OPF Jenkins
<!-- Start of text to be copied to usage.md of jpylyzer website -->

## Using jpylyzer from the command line
Expand Down Expand Up @@ -92,7 +91,7 @@ with *pip*. Then import *jpylyzer* into your code by adding:
from jpylyzer import jpylyzer
```
Subsequently you can call any function that is defined in *jpylyzer.py*.
In practice you will most likely only need the *checkOneFile* function.
In practice you will most likely only need the *checkOneFile* function.
The following minimal script shows how this works:

```python
Expand All @@ -111,7 +110,7 @@ imageHeight = myResult.findtext('./properties/jp2HeaderBox/imageHeaderBox/height
print(imageHeight)
```

Here, *myResult* is an *Element* object that can either be used directly,
Here, *myResult* is an *Element* object that can either be used directly,
or converted to XML using the *ElementTree* module[^3]. The structure of the
element object follows the XML output that described in [Chapter 5](#output-format).

Expand Down
173 changes: 0 additions & 173 deletions buildwin.sh

This file was deleted.

12 changes: 12 additions & 0 deletions docker-package-pypi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! /usr/bin/env bash
#
# Build Debian package in a Docker container
#

set -e

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

# Build in Docker container, save results, and show package info
docker run -v "$PWD":/src -v "$HOME":/pypirc --entrypoint "/src/package-pypi.sh" --rm python:3.6-stretch
Loading

0 comments on commit e1fa44f

Please sign in to comment.