Skip to content

Commit

Permalink
Merge branch 'release/0.25.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
lasote committed Jul 19, 2017
2 parents 784966b + e1b7ad4 commit e86b5d1
Show file tree
Hide file tree
Showing 124 changed files with 3,395 additions and 1,129 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,9 @@ cacert.pem

#Pyinstaller generated binaries
/pyinstaller

# Run tests in docker in current dir
.bash_history
.conan_server/
.sudo_as_admin_successful

10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,23 @@ os: linux
sudo: required
dist: trusty

env:
- CONAN_COMPILER=gcc CONAN_COMPILER_VERSION=4.8

matrix:
include:
- language: generic
os: osx
env: PYVER=py27 CONAN_COMPILER=apple-clang CONAN_COMPILER_VERSION=6.0 CONAN_LOGGING_LEVEL=20
osx_image: xcode8.3
env: PYVER=py27

- language: generic
os: osx
env: PYVER=py36 CONAN_COMPILER=apple-clang CONAN_COMPILER_VERSION=6.0 CONAN_LOGGING_LEVEL=20
osx_image: xcode8.3
env: PYVER=py36

# command to install dependencies
install:
- ./.ci/travis/install.sh
before_script:
- export PYTHONPATH=$PYTHONPATH:$(pwd)
- export CONAN_LOGGING_LEVEL=20
# command to run tests
script:
- ulimit -n 2048 # Error with py3 and OSX, max file descriptors
Expand Down
3 changes: 2 additions & 1 deletion conans/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
COMPLEX_SEARCH_CAPABILITY = "complex_search"
SERVER_CAPABILITIES = [COMPLEX_SEARCH_CAPABILITY, ]

__version__ = '0.24.0'

__version__ = '0.25.0'

1 change: 1 addition & 0 deletions conans/build_info/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ def run():
print(exc)
exit(1)


if __name__ == "__main__":
run()
9 changes: 5 additions & 4 deletions conans/build_info/conan_build_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def _get_upload_modules_with_deps(uploaded_files, downloaded_files):
else PackageReference.loads(module_id)
# Store recipe and package dependencies
if mod_doc["type"] == "package":
conan_infos = [file_doc for file_doc in mod_doc["files"] if file_doc["name"] == "conaninfo.txt"]
conan_infos = [file_doc for file_doc in mod_doc["files"]
if file_doc["name"] == "conaninfo.txt"]
if conan_infos:
conan_info = conan_infos[0]["path"]
info = ConanInfo.loads(load(conan_info))
Expand Down Expand Up @@ -99,17 +100,17 @@ def _get_only_downloads_module(downloaded_files):
"""
ret = BuildInfoModule()
ret.id = "DownloadOnly"
for ref, file_docs in downloaded_files.items():
for _, file_docs in downloaded_files.items():
files = file_docs["files"]
for file_doc in files:
the_type = _get_type(file_doc["path"])
dep = BuildInfoModuleDependency(file_doc["name"], the_type, file_doc["sha1"], file_doc["md5"])
dep = BuildInfoModuleDependency(file_doc["name"], the_type, file_doc["sha1"],
file_doc["md5"])
ret.dependencies.append(dep)
return ret


def _build_modules(trace_path):

uploaded_files = _extract_uploads_from_conan_trace(trace_path)
downloaded_files = _extract_downloads_from_conan_trace(trace_path)
if uploaded_files:
Expand Down
2 changes: 0 additions & 2 deletions conans/build_info/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,3 @@ def serialize(self):

BuildInfoModuleArtifact = namedtuple("BuildInfoModuleArtifact", ['type', 'sha1', 'md5', 'name'])
BuildInfoModuleDependency = namedtuple('BuildInfoModuleDependency', ['id', 'type', 'sha1', 'md5'])


93 changes: 36 additions & 57 deletions conans/client/build_requires.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
from conans.client.remote_registry import RemoteRegistry
from conans.client.printer import Printer
from conans.client.installer import ConanInstaller
from conans.client.require_resolver import RequireResolver
from conans.client.deps_builder import DepsGraphBuilder
import fnmatch
import copy
from conans.errors import ConanException
from conans.errors import conanfile_exception_formatter
from conans.model.ref import ConanFileReference
from collections import OrderedDict

Expand All @@ -21,6 +16,8 @@ def _apply_build_requires(deps_graph, conanfile):
conanfile.deps_env_info.update(build_require_conanfile.env_info, conan_ref.name)
conanfile.deps_env_info.update_deps_env_info(build_require_conanfile.deps_env_info)

conanfile.deps_user_info[conan_ref.name] = build_require_conanfile.user_info


class _RecipeBuildRequires(OrderedDict):
def __init__(self, conanfile):
Expand Down Expand Up @@ -48,73 +45,55 @@ def __str__(self):


class BuildRequires(object):
def __init__(self, loader, remote_proxy, output, client_cache, search_manager, build_requires,
current_path, build_modes):
self._remote_proxy = remote_proxy
self._client_cache = client_cache
self._output = output
self._current_path = current_path
def __init__(self, loader, graph_builder, registry, output, profile_build_requires):
self._loader = loader
self._cached_graphs = {}
self._search_manager = search_manager
self._build_requires = build_requires
self._build_modes = build_modes
self._graph_builder = graph_builder
self._output = output
self._registry = registry
self._profile_build_requires = profile_build_requires

def _get_recipe_build_requires(self, conanfile):
conanfile.build_requires = _RecipeBuildRequires(conanfile)
if hasattr(conanfile, "build_requirements"):
try:
with conanfile_exception_formatter(str(conanfile), "build_requirements"):
conanfile.build_requirements()
except Exception as e:
raise ConanException("Error in 'build_requirements()': %s" % str(e))

return conanfile.build_requires

def install(self, reference, conanfile):
def install(self, reference, conanfile, installer):
str_ref = str(reference)
package_build_requires = self._get_recipe_build_requires(conanfile)
for pattern, build_requires in self._build_requires.items():
for pattern, build_requires in self._profile_build_requires.items():
if ((not str_ref and pattern == "&") or
(str_ref and pattern == "&!") or
fnmatch.fnmatch(str_ref, pattern)):

package_build_requires.update(build_requires)

if package_build_requires:
str_build_requires = str(package_build_requires)
self._output.info("%s: Build requires: [%s]" % (str(reference), str_build_requires))

cached_graph = self._cached_graphs.get(str_build_requires)
if not cached_graph:
cached_graph = self._install(package_build_requires.values())
self._cached_graphs[str_build_requires] = cached_graph

_apply_build_requires(cached_graph, conanfile)

def _install(self, references):
self._output.info("Installing build requires: [%s]"
% ", ".join(str(r) for r in references))
conanfile = self._loader.load_virtual(references, None, scope_options=False) # No need current path

# FIXME: Forced update=True, build_mode, Where to define it?
update = False

local_search = None if update else self._search_manager
resolver = RequireResolver(self._output, local_search, self._remote_proxy)
graph_builder = DepsGraphBuilder(self._remote_proxy, self._output, self._loader, resolver)
deps_graph = graph_builder.load(conanfile)

registry = RemoteRegistry(self._client_cache.registry, self._output)
Printer(self._output).print_graph(deps_graph, registry)
self._output.info("Installing build requirements of: %s" % (str_ref or "PROJECT"))
self._output.info("Build requires: [%s]"
% ", ".join(str(r) for r in package_build_requires.values()))
# clear root package options, they won't match the build-require
conanfile.build_requires_options.clear_unscoped_options()
build_require_graph = self._install(package_build_requires.values(),
conanfile.build_requires_options, installer)

_apply_build_requires(build_require_graph, conanfile)
self._output.info("Installed build requirements of: %s" % (str_ref or "PROJECT"))

def _install(self, build_requires_references, build_requires_options, installer):
# No need current path
conanfile = self._loader.load_virtual(build_requires_references, None, scope_options=False,
build_requires_options=build_requires_options)
# compute and print the graph of transitive build-requires
deps_graph = self._graph_builder.load(conanfile)
Printer(self._output).print_graph(deps_graph, self._registry)

# Make sure we recursively do not propagate the "*" pattern
build_requires = copy.copy(self)
build_requires._build_requires = self._build_requires.copy()
build_requires._build_requires.pop("*", None)
build_requires._build_requires.pop("&!", None)

installer = ConanInstaller(self._client_cache, self._output, self._remote_proxy,
build_requires)
installer.install(deps_graph, self._build_modes, self._current_path)
self._output.info("Installed build requires: [%s]"
% ", ".join(str(r) for r in references))
old_build_requires = self._profile_build_requires.copy()
self._profile_build_requires.pop("*", None)
self._profile_build_requires.pop("&!", None)

installer.install(deps_graph, "")
self._profile_build_requires = old_build_requires # Restore original values
return deps_graph
Loading

0 comments on commit e86b5d1

Please sign in to comment.