Skip to content

Commit

Permalink
Merge branch 'release/0.20.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
lasote committed Nov 2, 2018
2 parents df1ecab + 24e8535 commit 1cdf1bf
Show file tree
Hide file tree
Showing 22 changed files with 621 additions and 90 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ python:
os: linux
sudo: required
dist: trusty
cache:
apt: true
directories:
- $HOME/.cache/pip
- /usr/local/Cellar

matrix:
include:
Expand Down
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ You can adjust other constructor parameters to control the build configurations

- **gcc_versions**: Generate only build configurations for the specified gcc versions (Ignored if the current machine is not Linux)
- **visual_versions**: Generate only build configurations for the specified Visual Studio versions (Ignore if the current machine is not Windows)
- **visual_runtimes**: Generate only build configurations for the specified runtimes, (only for Visual Studio)
- **visual_runtimes**: Generate only build configurations for the specified runtimes. (only for Visual Studio)
- **visual_toolsets**: Specify the toolsets per each specified Visual Studio version. (only for Visual Studio)
- **apple_clang_versions**: Generate only build configurations for the specified apple clang versions (Ignored if the current machine is not OSX)
- **archs**: Generate build configurations for the specified architectures, by default, ["x86", "x86_64"].
- **build_types**: Generate build configurations for the specified build_types, by default ["Debug", "Release"].
Expand All @@ -225,6 +226,7 @@ Or you can adjust environment variables:
- **CONAN_GCC_VERSIONS**
- **CONAN_VISUAL_VERSIONS**
- **CONAN_VISUAL_RUNTIMES**
- **CONAN_VISUAL_TOOLSETS**
- **CONAN_APPLE_CLANG_VERSIONS**
- **CONAN_CLANG_VERSIONS**
- **CONAN_ARCHS**
Expand Down Expand Up @@ -356,6 +358,44 @@ Also, it's possible to run some internal script, before to build the package:
builder.add_common_builds()
builder.run()

### Installing extra python packages before to build

Maybe you need to install some python packages using pip before to build your conan package. To solve this situation
you could use **pip_install**:

**Example**:

This example installs bincrafters-package-tools and conan-promote before to build:

from cpt.packager import ConanMultiPackager

if __name__ == "__main__":
builder = ConanMultiPackager(pip_install=["bincrafters-package-tools==0.17.0", "conan-promote==0.1.2"])
builder.add_common_builds()
builder.run()

But if you prefer to use environment variables:

export CONAN_PIP_INSTALL="bincrafters-package-tools==0.17.0,conan-promote=0.1.2"


### Installing custom Conan config

To solve custom profiles and remotes, Conan provides the [config](https://docs.conan.io/en/latest/reference/commands/consumer/config.html) feature where is possible to edit the conan.conf or install config files.

If you need to run `conan config install <url>` before to build there is the argument `config_url` in CPT:

from cpt.packager import ConanMultiPackager

if __name__ == "__main__":
config_url = "https://github.com/bincrafters/conan-config.git"
builder = ConanMultiPackager(config_url=config_url)
builder.add_common_builds()
builder.run()

But if are not interested to update your build.py script, it's possible to use environment variables instead:

export CONAN_CONFIG_URL=https://github.com/bincrafters/conan-config.git

## Specifying a different base profile

Expand Down Expand Up @@ -921,6 +961,7 @@ Using **CONAN_CLANG_VERSIONS** env variable in Travis ci or Appveyor:
- **always_update_conan_in_docker**: If True, "conan package tools" and "conan" will be installed and upgraded in the docker image in every build execution.
and the container won't be commited with the modifications.
- **docker_entry_script**: Command to be executed before to build when running Docker.
- **pip_install**: Package list to be installed by pip before to build. e.j ["foo", "bar"]
- **docker_32_images**: If defined, and the current build is arch="x86" the docker image name will be appended with "-i386". e.j: "conanio/gcc63-i386"
- **curpage**: Current page of packages to create
- **total_pages**: Total number of pages
Expand All @@ -938,6 +979,7 @@ Using **CONAN_CLANG_VERSIONS** env variable in Travis ci or Appveyor:
- "outdated": Build only missing or if the available package is not built with the current recipe. Useful to upload new configurations, e.j packages for a new compiler without
rebuild all packages.
- **test_folder**: Custom test folder consumed by Conan create, e.j .conan/test_package
- **config_url**: Conan config URL be installed before to build e.j https://github.com/bincrafters/conan-config.git

Upload related parameters:

Expand Down Expand Up @@ -1029,6 +1071,7 @@ This is especially useful for CI integration.
- **CONAN_SKIP_CHECK_CREDENTIALS**: Conan will skip checking the user credentials before building the packages. And if no user/remote is specified, will try to upload with the
already stored credentiales in the local cache. Default [False]
- **CONAN_DOCKER_ENTRY_SCRIPT**: Command to be executed before to build when running Docker.
- **CONAN_PIP_INSTALL**: Package list to be installed by pip before to build, comma separated, e.g. "pkg-foo==0.1.0,pkg-bar"
- **CONAN_GCC_VERSIONS**: Gcc versions, comma separated, e.g. "4.6,4.8,5,6"
- **CONAN_CLANG_VERSIONS**: Clang versions, comma separated, e.g. "3.8,3.9,4.0"
- **CONAN_APPLE_CLANG_VERSIONS**: Apple clang versions, comma separated, e.g. "6.1,8.0"
Expand All @@ -1037,6 +1080,7 @@ This is especially useful for CI integration.
- **CONAN_BUILD_TYPES**: Build types to build for, comma separated, e.g. "Release,Debug"
- **CONAN_VISUAL_VERSIONS**: Visual versions, comma separated, e.g. "12,14"
- **CONAN_VISUAL_RUNTIMES**: Visual runtimes, comma separated, e.g. "MT,MD"
- **CONAN_VISUAL_TOOLSETS**: Map Visual versions to toolsets, e.g. `14=v140;v140_xp,12=v120_xp`
- **CONAN_USE_DOCKER**: If defined will use docker
- **CONAN_CURRENT_PAGE**: Current page of packages to create
- **CONAN_TOTAL_PAGES**: Total number of pages
Expand Down Expand Up @@ -1064,6 +1108,7 @@ This is especially useful for CI integration.
- "missing": Build only missing packages.
- "outdated": Build only missing or if the available package is not built with the current recipe. Useful to upload new configurations, e.j packages for a new compiler without
rebuild all packages.
- **CONAN_CONFIG_URL**: Conan config URL be installed before to build e.j https://github.com/bincrafters/conan-config.git
- **CONAN_BASE_PROFILE**: Apply options, settings, etc. to this profile instead of `default`.
- **CONAN_IGNORE_SKIP_CI**: Ignore `[skip ci]` in commit message.
- **CPT_TEST_FOLDER**: Custom test_package path, e.j .conan/test_package
Expand Down
3 changes: 2 additions & 1 deletion cpt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

__version__ = '0.19.9'
__version__ = '0.20.0'
NEWEST_CONAN_SUPPORTED = "1.9"
55 changes: 42 additions & 13 deletions cpt/builds_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,29 @@ def get_mingw_config_from_env():
return ret


def get_env_visual_toolsets():
ret = {}
var = split_colon_env("CONAN_VISUAL_TOOLSETS")
if not var:
return None
for toolset_versions in var:
tmp = toolset_versions.split("=")
if len(tmp) != 2:
raise Exception("Invalid value for CONAN_VISUAL_TOOLSETS env variable, use "
"'14=v140;v140_xp,12=v120_xp'")
visual_version, tmp_toolsets = tmp
toolsets = tmp_toolsets.split(";")
ret[visual_version] = toolsets
return ret


class BuildGenerator(object):

def __init__(self, reference, os_name, gcc_versions, apple_clang_versions, clang_versions,
visual_versions, visual_runtimes, vs10_x86_64_enabled, mingw_configurations,
archs, allow_gcc_minors, build_types, options):
visual_versions, visual_runtimes, visual_toolsets, vs10_x86_64_enabled,
mingw_configurations, archs, allow_gcc_minors, build_types, options):

self._visual_toolsets = visual_toolsets
self._os_name = os_name
self._reference = reference
self._vs10_x86_64_enabled = vs10_x86_64_enabled
Expand Down Expand Up @@ -132,8 +149,9 @@ def get_builds(self, pure_c, shared_option_name, dll_with_static_runtime, refere
else:
builds = []
builds.extend(get_visual_builds(self._visual_versions, self._archs,
self._visual_runtimes, shared_option_name,
dll_with_static_runtime, self._vs10_x86_64_enabled,
self._visual_runtimes, self._visual_toolsets,
shared_option_name, dll_with_static_runtime,
self._vs10_x86_64_enabled,
self._build_types, self._options, ref))
return builds
elif self._os_name == "Linux":
Expand Down Expand Up @@ -211,28 +229,39 @@ def _make_mingw_builds(settings, options, build_requires, build_types, reference
return builds


def get_visual_builds(visual_versions, archs, visual_runtimes, shared_option_name,
dll_with_static_runtime, vs10_x86_64_enabled, build_types, options, reference=None):
def get_visual_builds(visual_versions, archs, visual_runtimes, visual_toolsets, shared_option_name,
dll_with_static_runtime, vs10_x86_64_enabled, build_types, options,
reference=None):

visual_toolsets = visual_toolsets or get_env_visual_toolsets()
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, build_types,
options, reference)

ret.extend(visual_builds)
if not visual_toolsets or not visual_toolsets.get(visual_version):
toolsets = [None]
else:
toolsets = visual_toolsets.get(visual_version)
for toolset in toolsets:
visual_builds = get_visual_builds_for_version(visual_runtimes, visual_version, arch,
shared_option_name,
dll_with_static_runtime, build_types,
options, reference, toolset=toolset)
ret.extend(visual_builds)
return ret


def get_visual_builds_for_version(visual_runtimes, visual_version, arch, shared_option_name,
dll_with_static_runtime, build_types, options, reference=None):
dll_with_static_runtime, build_types, options, reference=None,
toolset=None):
base_set = {"compiler": "Visual Studio",
"compiler.version": visual_version,
"arch": arch}

if toolset:
base_set["compiler.toolset"] = toolset
sets = []

debug_builds = set(['Debug'])
Expand Down
11 changes: 11 additions & 0 deletions cpt/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@


class ConfigManager(object):

def __init__(self, conan_api, printer):
self._conan_api = conan_api
self.printer = printer

def install(self, url):
self.printer.print_message("Installing config from address %s" % url)
self._conan_api.config_install(item=url, verify_ssl=True)
Loading

0 comments on commit 1cdf1bf

Please sign in to comment.