Skip to content

Commit

Permalink
Refactor CI, Deploy to latest PyPy versions.
Browse files Browse the repository at this point in the history
Refactors Python installs and sets up virtual environments.

PyPy virtualenv is a hack, there's an issue with PowerShell scripts.
  • Loading branch information
HexDecimal committed Dec 29, 2017
1 parent c7ba6a2 commit beca7c4
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 26 deletions.
24 changes: 24 additions & 0 deletions .appveyor/install_python.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
if ($env:PYPY -or $env:PYPY3) {
if($env:PYPY3){
$env:PYPY_EXE='pypy3.exe'
$env:PYPY=$env:PYPY3
} else {
$env:PYPY_EXE='pypy.exe'
}
$env:PYTHON = 'C:\' + $env:PYPY + '\' + $env:PYPY_EXE
$env:PATH += ';' + 'C:\' + $env:PYPY + '\'
$PYPY_DOWNLOAD = 'https://bitbucket.org/pypy/pypy/downloads/' + $env:PYPY + '.zip'
Invoke-WebRequest $PYPY_DOWNLOAD -OutFile C:\pypy.zip
& '7z' x C:\pypy.zip -oC:\
& $env:PYTHON -m ensurepip
}
& $env:PYTHON -m pip install --disable-pip-version-check virtualenv
& $env:PYTHON -m virtualenv venv

if ($env:PYPY) {
# HACK 2017-12-28 HexDecimal, remove this code once pypy virtual
# environments are fixed for `activate.ps1`
cp -r venv/bin venv/Scripts
}
. ./venv/Scripts/activate.ps1
if($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode ) }
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ matrix:
- os: osx
language: generic
env: PYPY_VERSION=5.8.0

- os: osx
language: generic
env: PYPY_VERSION=5.9.0
fast_finish: true

sudo: required
Expand All @@ -50,7 +52,7 @@ before_install:
- 'if [[ "$BREW_PYTHON3" == "true" ]]; then virtualenv venv -p python3; fi'
- 'if [[ "$BREW_PYTHON3" == "true" ]]; then source venv/bin/activate; fi'
- source .travis/install_python.sh
- pip install --upgrade pip setuptools
- pip install --disable-pip-version-check --upgrade pip setuptools
- 'pip install -U hg+https://bitbucket.org/HexDecimal/wheel@abi3-windows-fix#egg=wheel'
- 'if [[ "$TRAVIS_PYTHON_VERSION" == pypy* || -n "$PYPY_VERSION" ]]; then pip install git+https://bitbucket.org/pypy/numpy.git; fi'
- pip install --requirement requirements.txt
Expand Down
6 changes: 4 additions & 2 deletions .travis/install_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,12 @@ function get_pypy3_build_prefix {
if [[ $version =~ ([0-9]+)\.([0-9]+) ]]; then
local major=${BASH_REMATCH[1]}
local minor=${BASH_REMATCH[2]}
if (( $major <= 2 )); then
if (( $major == 5 && $minor <= 5 )); then
echo "pypy3.3-v"
elif (( $major < 5 )); then
echo "pypy3-"
else
echo "pypy3.3-v"
echo "pypy3-v"
fi
else
echo "error: expected version number, got $1" 1>&2
Expand Down
40 changes: 18 additions & 22 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ environment:
- PYPY: pypy2-v5.8.0-win32
platform: Any CPU
DEPLOY_ONLY: true
- PYPY: pypy2-v5.9.0-win32
platform: Any CPU
DEPLOY_ONLY: true
- PYPY: pypy2-v5.10.0-win32
platform: Any CPU
DEPLOY_ONLY: true

matrix:
allow_failures:
Expand All @@ -52,38 +58,28 @@ init:

install:
- cmd: "git submodule update --init --recursive"
- ps: |
if ($env:PYPY){
$env:PYTHON = 'C:\' + $env:PYPY + '\pypy.exe'
$env:PATH += ';' + 'C:\' + $env:PYPY + '\'
$PYPY_DOWNLOAD = 'https://bitbucket.org/pypy/pypy/downloads/' + $env:PYPY + '.zip'
Invoke-WebRequest $PYPY_DOWNLOAD -OutFile C:\pypy.zip
& '7z' x C:\pypy.zip -oC:\
& $env:PYTHON -m ensurepip
& $env:PYTHON -m pip install --disable-pip-version-check -U pip
# manually install a version of wheel with pypy fixes
& $env:PYTHON -m pip install https://bitbucket.org/pypa/wheel/get/f4d5d07efa60.zip
}
- ps: ". .appveyor/install_python.ps1"
- cmd: "python --version"
- cmd: "set PATH=%PATH%;C:\\MinGW\\bin"
- cmd: echo "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 > "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64/vcvars64.bat"
- cmd: "%PYTHON% -m pip install --upgrade pip setuptools"
- cmd: "if defined PYPY %PYTHON% -m pip -v install git+https://bitbucket.org/pypy/numpy.git"
- '%PYTHON% -m pip install -e hg+https://bitbucket.org/HexDecimal/wheel@abi3-windows-fix#egg=wheel'
- cmd: "%PYTHON% -m pip install --requirement requirements.txt"
- cmd: "%PYTHON% setup.py build sdist develop bdist_wheel"
- cmd: "pip install --upgrade pip setuptools"
- cmd: "if defined PYPY pip install git+https://bitbucket.org/pypy/numpy.git"
- 'pip install -e hg+https://bitbucket.org/HexDecimal/wheel@abi3-windows-fix#egg=wheel'
- cmd: "pip install --requirement requirements.txt"
- cmd: "python setup.py build sdist develop bdist_wheel"
build: off
before_test:
- cmd: "%PYTHON% -m pip install pytest pytest-cov"
- cmd: "pip install pytest pytest-cov"
test_script:
- cmd: "%PYTHON% -m pytest -v"
- ps: "python -m pytest -v"

on_success:
- "C:\\Python27\\python.exe -m virtualenv py27venv"
- py27venv\Scripts\activate.bat
- "pip install codacy-coverage python-coveralls"
- pip install codacy-coverage python-coveralls
- coverage xml
- python-codacy-coverage -r coverage.xml

deploy_script:
- "if defined APPVEYOR_REPO_TAG_NAME %PYTHON% -m pip install twine"
- "if defined APPVEYOR_REPO_TAG_NAME %PYTHON% -m twine upload --skip-existing dist/*"
- "if defined APPVEYOR_REPO_TAG_NAME pip install twine"
- "if defined APPVEYOR_REPO_TAG_NAME twine upload --skip-existing dist/*"

0 comments on commit beca7c4

Please sign in to comment.