Skip to content

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
lasote committed Apr 21, 2017
2 parents 1f7fde9 + bdd71c2 commit 845b49e
Show file tree
Hide file tree
Showing 20 changed files with 887 additions and 513 deletions.
4 changes: 4 additions & 0 deletions .ci/appveyor/install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%
SET PYTHONPATH=%PYTHONPATH%;%CD%
%PYTHON%/Scripts/pip.exe install -r conan/requirements_test.txt
%PYTHON%/Scripts/pip.exe install -r conan/requirements.txt
3 changes: 3 additions & 0 deletions .ci/appveyor/test.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
conan user
mkdir %HOMEPATH%/.conan/data
nosetests conan.test
49 changes: 49 additions & 0 deletions .ci/travis/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

set -e
set -x

if [[ "$(uname -s)" == 'Darwin' ]]; then
brew update || brew update
brew outdated pyenv || brew upgrade pyenv
brew install pyenv-virtualenv

if which pyenv > /dev/null; then
eval "$(pyenv init -)"
fi
if which pyenv > /dev/null; then
eval "$(pyenv init -)"
fi

case "${PYVER}" in
py27)
pyenv install 2.7.10
pyenv virtualenv 2.7.10 conan
;;
py33)
pyenv install 3.3.6
pyenv virtualenv 3.3.6 conan
;;
py34)
pyenv install 3.4.3
pyenv virtualenv 3.4.3 conan
;;
py35)
pyenv install 3.5.0
pyenv virtualenv 3.5.0 conan
;;
py36)
pyenv install 3.6.0
pyenv virtualenv 3.6.0 conan
;;

esac
pyenv rehash
pyenv activate conan
else
sudo apt-get update
sudo apt-get install gcc-multilib g++-multilib
fi

pip install -r conan/requirements.txt
pip install -r conan/requirements_test.txt
15 changes: 15 additions & 0 deletions .ci/travis/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e
set -x

if [[ "$(uname -s)" == 'Darwin' ]]; then
if which pyenv > /dev/null; then
eval "$(pyenv init -)"
fi
pyenv activate conan
fi

conan user
mkdir ~/.conan/data
nosetests conan.test
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
cache: pip
language: python
python:
- 2.7
- 3.6
os: linux
sudo: required
dist: trusty

matrix:
include:
- language: generic
os: osx
env: PYVER=py27

# command to install dependencies
install:
- ./.ci/travis/install.sh
before_script:
- export PYTHONPATH=$PYTHONPATH:$(pwd)
# command to run tests
script:
- ./.ci/travis/run.sh
39 changes: 15 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,13 @@ Or you can [clone this repository](http://github.com/conan-io/conan-package-tool

## Quick start

Suppose you are creating a conan package.
You must have a **conanfile.py** file and a **test** folder in your current directory and the **conan test** command must work.
If you don't have it ready, take a look to [Automatically creating and testing packages](http://docs.conan.io/en/latest/packaging/testing.html)

In your **test/conanfile.py** you need to make a small adjustement, the require (current library) needs to be configurable with environment variables:


channel = os.getenv("CONAN_CHANNEL", "testing")
username = os.getenv("CONAN_USERNAME", "myuser")

class DefaultNameConan(ConanFile):
...
requires = "zlib/1.2.8@%s/%s" % (username, channel)
...

You must have a **conanfile.py** file and a **test_package** folder in your current directory and the **conan test_package** command must work.
If you don't have it ready, take a look to [Getting started creating packages](http://docs.conan.io/en/latest/packaging/getting_started.html)

Now create a **build.py** file in the root of your project and instance a **ConanMultiPackager**:



from conan.packager import ConanMultiPackager
from conan.packager import ConanMultiPackager

if __name__ == "__main__":
builder = ConanMultiPackager(username="myuser")
Expand Down Expand Up @@ -80,28 +66,32 @@ You can use **builder.add\_common\_builds** method and remove some configuration
builder = ConanMultiPackager(username="myuser")
builder.add_common_builds()
filtered_builds = []
for settings, options in builder.builds:
for settings, options, env_vars, build_requires in builder.builds:
if settings["compiler.version"] == "4.6":
filtered_builds.append([settings, options])
filtered_builds.append([settings, options, env_vars, build_requires])
builder.builds = filtered_builds
builder.run()


Or add package's configurations without these method (settings and options):
Or add package's configurations without these method (settings, options, environment variables and build requires):

from conan.packager import ConanMultiPackager

if __name__ == "__main__":
builder = ConanMultiPackager(username="myuser")
builder.add({"arch": "x86", "build_type": "Release"}, {"mypackage:option1": "ON"})
builder.add({"arch": "x86", "build_type": "Release"},
{"mypackage:option1": "ON"},
{"PATH": "/path/to/custom"},
{"*": ["MyBuildPackage/1.0@lasote/testing"]})
builder.add({"arch": "x86_64", "build_type": "Release"}, {"mypackage:option1": "ON"})
builder.add({"arch": "x86", "build_type": "Debug"}, {"mypackage:option2": "OFF", "mypackage:shared": True})
builder.run()


## Visual Studio auto-configuration

When the builder detects a Visual Studio compiler and its version, it will automatically configure the execution environment for the "conan test" command with the **vcvarsall.bat** script (provided by all Microsoft Visual Studio versions).
When the builder detects a Visual Studio compiler and its version, it will automatically configure the execution environment
for the "conan test" command with the **vcvarsall.bat** script (provided by all Microsoft Visual Studio versions).
So you can compile your project with the right compiler automatically, even without CMake.

## MinGW builds
Expand Down Expand Up @@ -130,8 +120,6 @@ Or passing a list to ConanMultiPackager constructor:
builder = ConanMultiPackager(username="lasote", mingw_configurations=mingw_configurations)
builder.add_common_builds(pure_c=False)
builder.run()

TODO: Handle shared option and control debug/release builds.


## Pagination
Expand Down Expand Up @@ -248,6 +236,7 @@ You can copy the files from this [conan-zlib repository](https://github.com/laso
- CONAN_USERNAME="lasote"
- CONAN_CHANNEL="ci"
- CONAN_TOTAL_PAGES=2
- CONAN_STABLE_BRANCH_PATTERN="release/*"

matrix:
- CONAN_GCC_VERSIONS=4.6 CONAN_CURRENT_PAGE=1 CONAN_USE_DOCKER=1
Expand Down Expand Up @@ -319,6 +308,7 @@ In case you need just one job per compiler to compile all the packages:
- CONAN_CHANNEL="ci"
- CONAN_TOTAL_PAGES=1
- CONAN_CURRENT_PAGE=1
- CONAN_STABLE_BRANCH_PATTERN="release/*"

matrix:
- CONAN_GCC_VERSIONS=4.6 CONAN_USE_DOCKER=1
Expand Down Expand Up @@ -410,6 +400,7 @@ This is very similar to Travis CI. With the same **build.py** script we have the
CONAN_USERNAME: "lasote"
CONAN_CHANNEL: "ci"
CONAN_TOTAL_PAGES: 4
CONAN_STABLE_BRANCH_PATTERN: "release/*"

matrix:
- CONAN_CURRENT_PAGE: 1
Expand Down
10 changes: 10 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
environment:
matrix:
- PYTHON: "C:\\Python27"
- PYTHON: "C:\\Python35"
build: false
install:
- .ci/appveyor/install.bat
test_script:
- .ci/appveyor/test.bat

170 changes: 170 additions & 0 deletions conan/builds_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
import copy
from collections import namedtuple

BuildConf = namedtuple("BuildConf", "settings options env_vars build_requires")


def get_mingw_builds(mingw_configurations, mingw_installer_reference, archs):
builds = []
for config in mingw_configurations:
version, arch, exception, thread = config
if arch not in archs:
continue
settings = {"arch": arch, "compiler": "gcc",
"compiler.version": version[0:3],
"compiler.threads": thread,
"compiler.exception": exception}
options, build_requires = _add_mingw_build_require(settings, mingw_installer_reference)

settings.update({"compiler.libcxx": "libstdc++"})
settings.update({"build_type": "Release"})
builds.append(BuildConf(settings, options, {}, build_requires))
s2 = copy.copy(settings)
s2.update({"build_type": "Debug"})

builds.append(BuildConf(s2, options, {}, build_requires))
return builds


def _add_mingw_build_require(settings, mingw_installer_reference):
installer_options = {}
for setting in ("compiler.threads", "compiler.exception", "compiler.version", "arch"):
setting_value = settings.get(setting, None)
if setting_value:
short_name = setting.split(".", 1)[-1]
option_name = "%s:%s" % (mingw_installer_reference.name, short_name)
installer_options[option_name] = setting_value

return installer_options, {"*": [mingw_installer_reference]}


def get_visual_builds(visual_versions, archs, visual_runtimes, shared_option_name,
dll_with_static_runtime, vs10_x86_64_enabled):
ret = []
for visual_version in visual_versions:
visual_version = str(visual_version)
for arch in archs:
if not vs10_x86_64_enabled and arch == "x86_64" and visual_version == "10":
continue
visual_builds = get_visual_builds_for_version(visual_runtimes, visual_version, arch,
shared_option_name, dll_with_static_runtime)

ret.extend(visual_builds)
return ret


def get_visual_builds_for_version(visual_runtimes, visual_version, arch, shared_option_name, dll_with_static_runtime):
base_set = {"compiler": "Visual Studio",
"compiler.version": visual_version,
"arch": arch}
sets = []

if shared_option_name:
if "MT" in visual_runtimes:
sets.append(({"build_type": "Release", "compiler.runtime": "MT"},
{shared_option_name: False}, {}, {}))
if dll_with_static_runtime:
sets.append(({"build_type": "Release", "compiler.runtime": "MT"},
{shared_option_name: True}, {}, {}))
if "MTd" in visual_runtimes:
sets.append(({"build_type": "Debug", "compiler.runtime": "MTd"},
{shared_option_name: False}, {}, {}))
if dll_with_static_runtime:
sets.append(({"build_type": "Debug", "compiler.runtime": "MTd"},
{shared_option_name: True}, {}, {}))
if "MD" in visual_runtimes:
sets.append(({"build_type": "Release", "compiler.runtime": "MD"},
{shared_option_name: False}, {}, {}))
sets.append(({"build_type": "Release", "compiler.runtime": "MD"},
{shared_option_name: True}, {}, {}))
if "MDd" in visual_runtimes:
sets.append(({"build_type": "Debug", "compiler.runtime": "MDd"},
{shared_option_name: False}, {}, {}))
sets.append(({"build_type": "Debug", "compiler.runtime": "MDd"},
{shared_option_name: True}, {}, {}))

else:
if "MT" in visual_runtimes:
sets.append(({"build_type": "Release", "compiler.runtime": "MT"}, {}, {}, {}))
if "MTd" in visual_runtimes:
sets.append(({"build_type": "Debug", "compiler.runtime": "MTd"}, {}, {}, {}))
if "MDd" in visual_runtimes:
sets.append(({"build_type": "Debug", "compiler.runtime": "MDd"}, {}, {}, {}))
if "MD" in visual_runtimes:
sets.append(({"build_type": "Release", "compiler.runtime": "MD"}, {}, {}, {}))

ret = []
for setting, options, env_vars, build_requires in sets:
tmp = copy.copy(base_set)
tmp.update(setting)
ret.append(BuildConf(tmp, options, env_vars, build_requires))

return ret


def get_build(compiler, the_arch, the_build_type, the_compiler_version, the_libcxx=None, the_shared_option_name=None, the_shared=None):
options = {}
if the_shared_option_name:
options = {the_shared_option_name: the_shared}
setts = {"arch": the_arch,
"build_type": the_build_type,
"compiler": compiler,
"compiler.version": the_compiler_version}
if the_libcxx:
setts["compiler.libcxx"] = the_libcxx

return BuildConf(setts, options, {}, {})


def get_osx_apple_clang_builds(apple_clang_versions, archs, shared_option_name, pure_c):
ret = []

# Not specified compiler or compiler version, will use the auto detected
for compiler_version in apple_clang_versions:
for arch in archs:
if shared_option_name:
for shared in [True, False]:
for build_type in ["Debug", "Release"]:
if not pure_c:
ret.append(get_build("apple-clang", arch, build_type, compiler_version,
"libc++", shared_option_name, shared))
else:
ret.append(get_build("apple-clang", arch, build_type, compiler_version, None, shared_option_name, shared))
else:
for build_type in ["Debug", "Release"]:
if not pure_c:
ret.append(get_build("apple-clang", arch, build_type, compiler_version, "libc++"))
else:
ret.append(get_build("apple-clang", arch, build_type, compiler_version))

return ret


def get_linux_gcc_builds(gcc_versions, archs, shared_option_name, pure_c):
ret = []
# Not specified compiler or compiler version, will use the auto detected
for gcc_version in gcc_versions:
for arch in archs:
if shared_option_name:
for shared in [True, False]:
for build_type in ["Debug", "Release"]:
if not pure_c:
ret.append(get_build("gcc", arch, build_type, gcc_version,
"libstdc++", shared_option_name, shared))
if float(gcc_version) > 5:
ret.append(get_build("gcc", arch, build_type, gcc_version,
"libstdc++11", shared_option_name, shared))
else:
ret.append(get_build("gcc", arch, build_type, gcc_version,
None, shared_option_name, shared))
else:
for build_type in ["Debug", "Release"]:
if not pure_c:
ret.append(get_build("gcc", arch, build_type, gcc_version,
"libstdc++"))
if float(gcc_version) > 5:
ret.append(get_build("gcc", arch, build_type, gcc_version,
"libstdc++11"))
else:
ret.append(get_build("gcc", arch, build_type, gcc_version))
return ret
Loading

0 comments on commit 845b49e

Please sign in to comment.