Skip to content

Commit

Permalink
fix VS activation; support VS env var for fiding; Appveyor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
msarahan committed May 13, 2016
1 parent a0bd2ae commit e460b7a
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 136 deletions.
15 changes: 2 additions & 13 deletions .binstar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,14 @@ env:
#===============================================================================

## Run before the script
# before_script:
# - echo "before_script!"
before_script:
- python -c "from platform import system as s; import sys; sys.exit(int(s()!='Windows'))" || export SOURCE_DIR=$SOURCE_DIR
## Put your main computations here!
script:
# - echo 4.1.0.rc1 > conda/.version
- python -c "from platform import system as s; import sys; sys.exit(int(s()!='Windows'))" || conda build conda.recipe --python $PYTHON_VERSION
- python -c "from platform import system as s; import sys; sys.exit(int(s()=='Windows'))" || conda build conda.recipe --python %PYTHON_VERSION%

## This will run after the script regardless of the result of script
## BINSTAR_BUILD_RESULT=[succcess|failure]
# after_script:
# - echo "The build was a $BINSTAR_BUILD_RESULT" | tee artifact1.txt
## This will be run only after a successful build
# after_success:
# - echo "after_success!"
## This will be run only after a build failure
# after_failure:
# - echo "after_failure!"

#===============================================================================
# Build Results
# Build results are split into two categories: artifacts and targets
Expand Down
50 changes: 33 additions & 17 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,30 @@ environment:
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\tools\\appveyor\\run_with_env.cmd"

matrix:
- PYTHON: "C:\\Python27_32"
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "32"
- PYTHON: "C:\\Python35_64"
PYTHON_VERSION: "3.5"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python27_64"
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python34_32"
PYTHON_VERSION: "3.4"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python34_64"
PYTHON_VERSION: "3.4"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python27_32"
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python35_32"
PYTHON_VERSION: "3.5"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python35_64"
PYTHON_VERSION: "3.5"
PYTHON_ARCH: "64"
- PYTHON: "C:\\Python34_32"
PYTHON_VERSION: "3.4"
PYTHON_ARCH: "32"


init:
- ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH% %HOME%
Expand All @@ -43,28 +44,43 @@ install:
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
- powershell ./utils/install.ps1
- set PATH=%HOME%/miniconda;%HOME%/miniconda/Scripts;%$HOME%/miniconda/Library/bin;%PATH%
# reverse python versions for base, to avoid file permissions errors when base == test version
- if "%PYTHON_VERSION%" == "3.4" set "BASE_PYTHON_VERSION=3"
- if "%PYTHON_VERSION%" == "3.5" set "BASE_PYTHON_VERSION=35"
- if "%PYTHON_ARCH%" == "64" set "ARCH_LABEL=-x64"
- set "CONDA_ROOT=C:\Miniconda%BASE_PYTHON_VERSION%%ARCH_LABEL%"
- for /f "usebackq tokens=2,*" %%A in (`reg query HKCU\Environment /v PATH`) do set "USERPATH=%%B"
- set "USERPATH=%CONDA_ROOT%;%CONDA_ROOT%\Scripts;%CONDA_ROOT%\Library\bin;%USERPATH%"
- set "PATH=%USERPATH%;%PATH%"
- setx PATH "%USERPATH%"
- conda info
- conda config --set always_yes yes
- conda update -q --all
- python -c "import sys; print(sys.version)"
- python -c "import sys; print(sys.executable)"
- python -c "import sys; print(sys.prefix)"
- conda install -q python=%PYTHON_VERSION%
- conda install -q -c conda pytest requests pycrypto conda-build
- conda install -q git
- conda install -q pytest requests pycrypto git anaconda-client
# this is to ensure dependencies
- conda install -q conda-build
- pip install auxlib pytest-cov
- python --version
- python -c "import struct; print(struct.calcsize('P') * 8)"
- python setup.py install
- set PATH
- conda build --version
- ps: (New-Object Net.WebClient).DownloadFile("https://github.com/menpo/condaci/raw/master/vs2008_patch.zip", "c:\vs2008_patch.zip")
- 7z x C:\vs2008_patch.zip -oc:\vs2008_patch
- call c:\vs2008_patch\setup_x64.bat
- copy "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat"


# Not a .NET project, we build scikit-image in the install step instead
# Not a .NET project, we build package in the install step instead
build: false

test_script:
- py.test --cov conda --cov-report xml tests
- set "PATH=%CONDA_ROOT%;%CONDA_ROOT%\Scripts;%CONDA_ROOT%\Library\bin;%PATH%"
- set PATH
- py.test --cov conda_build --cov-report xml tests || appveyor PushArtifact %PYTHON%/conda-bld/work/CMakeFiles/CMakeOutput.log && appveyor PushArtifact %PYTHON%/conda-bld/work/CMakeFiles/CMakeError.log

on_success:
- pip install codecov
Expand Down
3 changes: 3 additions & 0 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ requirements:
- patchelf [linux]

test:
requires:
- pytest
- pytest-cov
commands:
- conda-build -h
imports:
Expand Down
4 changes: 4 additions & 0 deletions conda.recipe/run_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import os

import pytest
import conda_build

print('conda_build.__version__: %s' % conda_build.__version__)
pytest.main([os.path.join(os.getenv("SOURCE_DIR"), 'tests')])
4 changes: 3 additions & 1 deletion conda_build/main_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ def execute(args, parser):
continue
if args.skip_existing:
# 'or m.pkg_fn() in index' is for conda <4.1 and could be removed in the future.
if 'local::' + m.pkg_fn() in index or m.pkg_fn() in index or m.pkg_fn() in already_built:
if ('local::' + m.pkg_fn() in index or
m.pkg_fn() in index or
m.pkg_fn() in already_built):
print(m.dist(), "is already built, skipping.")
continue
if args.output:
Expand Down
15 changes: 10 additions & 5 deletions conda_build/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,14 @@ def build_vcvarsall_vs_path(version):
Expected versions are of the form {9, 10, 12, 14}
"""
return os.path.join(PROGRAM_FILES_PATH,
'Microsoft Visual Studio {}'.format(version), 'VC',
'vcvarsall.bat')
vstools = "VS{0}0COMNTOOLS".format(version)
if vstools in os.environ:
return os.path.join(os.environ[vstools], '..\\..\\VC\\vcvarsall.bat')
else:
# prefer looking at env var; fall back to program files defaults
return os.path.join(PROGRAM_FILES_PATH,
'Microsoft Visual Studio {}'.format(version), 'VC',
'vcvarsall.bat')


def fix_staged_scripts():
Expand Down Expand Up @@ -196,14 +201,14 @@ def build(m, bld_bat):
with open(bld_bat) as fi:
data = fi.read()
with open(join(src_dir, 'bld.bat'), 'w') as fo:
fo.write(msvc_env_cmd(bits=cc.bits, override=m.get_value('build/msvc_compiler', None)))
fo.write('\n')
# more debuggable with echo on
fo.write('@echo on\n')
for key, value in env.items():
fo.write('set "{key}={value}"\n'.format(key=key, value=value))
fo.write("set INCLUDE={};%INCLUDE%\n".format(env["LIBRARY_INC"]))
fo.write("set LIB={};%LIB%\n".format(env["LIBRARY_LIB"]))
fo.write(msvc_env_cmd(bits=cc.bits, override=m.get_value('build/msvc_compiler', None)))
fo.write('\n')
fo.write("REM ===== end generated header =====\n")
fo.write(data)

Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ norecursedirs= tests/test-recipes .* *.egg* build dist
addopts =
--junitxml=junit.xml
--ignore setup.py
--ignore run_test.py
--cov-report term-missing
--tb native
--strict
2 changes: 1 addition & 1 deletion tests/test-recipes/metadata/entry_points/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package:
version: 1.0

source:
git_url: ../../../../
path: ../../../../

build:
entry_points:
Expand Down
2 changes: 1 addition & 1 deletion tests/test-recipes/metadata/osx_is_app/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package:
version: 1.0

source:
git_url: ../../../../
path: ../../../../

build:
entry_points:
Expand Down
98 changes: 0 additions & 98 deletions utils/install.ps1

This file was deleted.

0 comments on commit e460b7a

Please sign in to comment.