Skip to content

Commit

Permalink
Merge branch 'release/0.5.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
lasote committed Aug 8, 2017
2 parents 08749cf + 0f98d9d commit c823397
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 41 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ This is especially useful for CI integration.
- **CONAN_CHANNEL**: Channel where your packages will be uploaded if the previous parameter doesn't match
- **CONAN_PIP_PACKAGE**: Specify a conan package to install (by default, installs the latest) e.j conan==0.0.1rc7
- **MINGW_CONFIGURATIONS**: Specify a list of MinGW builds. See MinGW builds section.
- **CONAN_BASH_PATH**: Path to a bash executable. Used only in windows to help the tools.run_in_windows_bash() function to locate our Cygwin/MSYS2 bash.
Set it with the bash executable path if it’s not in the PATH or you want to use a different one.


# Full example
Expand Down
4 changes: 1 addition & 3 deletions conan/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
__version__ = '0.5.3'


__version__ = '0.5.4'
36 changes: 19 additions & 17 deletions conan/builds_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
BuildConf = namedtuple("BuildConf", "settings options env_vars build_requires")


def get_mingw_builds(mingw_configurations, mingw_installer_reference, archs):
def get_mingw_builds(mingw_configurations, mingw_installer_reference, archs, shared_option_name):
builds = []
for config in mingw_configurations:
version, arch, exception, thread = config
Expand All @@ -14,28 +14,30 @@ def get_mingw_builds(mingw_configurations, mingw_installer_reference, archs):
"compiler.version": version[0:3],
"compiler.threads": thread,
"compiler.exception": exception}
options, build_requires = _add_mingw_build_require(settings, mingw_installer_reference)
build_requires = {"*": [mingw_installer_reference]}
options = {}

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"})
if shared_option_name:
for shared in [True, False]:
opt = copy.copy(options)
opt[shared_option_name] = shared
builds += _make_mingw_builds(settings, opt, build_requires)
else:
builds += _make_mingw_builds(settings, options, build_requires)

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
def _make_mingw_builds(settings, options, build_requires):
builds = []
settings.update({"build_type": "Release"})
settings.update({"compiler.libcxx": "libstdc++"})
builds.append(BuildConf(settings, options, {}, build_requires))

return installer_options, {"*": [mingw_installer_reference]}
s2 = copy.copy(settings)
s2.update({"build_type": "Debug"})
builds.append(BuildConf(s2, options, {}, build_requires))
return builds


def get_visual_builds(visual_versions, archs, visual_runtimes, shared_option_name,
Expand Down
5 changes: 3 additions & 2 deletions conan/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def __init__(self, args=None, username=None, channel=None, runner=None,

self.mingw_configurations = mingw_configurations or get_mingw_config_from_env()
self.mingw_installer_reference = ConanFileReference.loads(os.getenv("CONAN_MINGW_INSTALLER_REFERENCE") or
"mingw_installer/0.1@lasote/testing")
"mingw_installer/1.0@conan/stable")

self.archs = archs or \
list(filter(None, os.getenv("CONAN_ARCHS", "").split(","))) or \
Expand Down Expand Up @@ -256,7 +256,8 @@ def add_common_builds(self, shared_option_name=None, pure_c=True, dll_with_stati
builds = []
if self._platform_info.system() == "Windows":
if self.mingw_configurations:
builds = get_mingw_builds(self.mingw_configurations, self.mingw_installer_reference, self.archs)
builds = get_mingw_builds(self.mingw_configurations, self.mingw_installer_reference, self.archs,
shared_option_name)
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))
elif self._platform_info.system() == "Linux":
Expand Down
30 changes: 21 additions & 9 deletions conan/test/generators_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,35 @@ def test_mingw_generator(self):

mingw_configurations = [("4.9", "x86", "dwarf2", "posix")]

builds = get_mingw_builds(mingw_configurations, ConanFileReference.loads("mingw_installer/1.0@lasote/testing"), ["x86"])
builds = get_mingw_builds(mingw_configurations, ConanFileReference.loads(
"mingw_installer/1.0@conan/stable"), ["x86"], "pack:shared")
expected = [
({'build_type': 'Release', 'compiler.version': '4.9', 'compiler.libcxx': 'libstdc++',
({'build_type': 'Release', 'compiler.version': '4.9', 'compiler.libcxx': "libstdc++",
'compiler': 'gcc', 'arch': 'x86', 'compiler.exception': 'dwarf2',
'compiler.threads': 'posix'},
{'mingw_installer:arch': 'x86', 'mingw_installer:version': '4.9',
'mingw_installer:threads': 'posix', 'mingw_installer:exception': 'dwarf2'},
{'pack:shared': True},
{},
{'*': [ConanFileReference.loads("mingw_installer/1.0@lasote/testing")]}),
{'*': [ConanFileReference.loads("mingw_installer/1.0@conan/stable")]}),
({'compiler.version': '4.9', 'compiler': 'gcc', 'compiler.libcxx': "libstdc++",
'build_type': 'Debug', 'compiler.exception': 'dwarf2', 'compiler.threads': 'posix',
'arch': 'x86'},
{'pack:shared': True},
{},
{'*': [ConanFileReference.loads("mingw_installer/1.0@conan/stable")]}),

({'compiler.version': '4.9', 'compiler.libcxx': 'libstdc++', 'compiler': 'gcc',
({'build_type': 'Release', 'compiler.version': '4.9', 'compiler.libcxx': "libstdc++",
'compiler': 'gcc', 'arch': 'x86', 'compiler.exception': 'dwarf2',
'compiler.threads': 'posix'},
{'pack:shared': False},
{},
{'*': [ConanFileReference.loads("mingw_installer/1.0@conan/stable")]}),
({'compiler.version': '4.9', 'compiler': 'gcc', 'compiler.libcxx': "libstdc++",
'build_type': 'Debug', 'compiler.exception': 'dwarf2', 'compiler.threads': 'posix',
'arch': 'x86'},
{'mingw_installer:arch': 'x86', 'mingw_installer:version': '4.9',
'mingw_installer:threads': 'posix', 'mingw_installer:exception': 'dwarf2'},
{'pack:shared': False},
{},
{'*': [ConanFileReference.loads("mingw_installer/1.0@lasote/testing")]})]
{'*': [ConanFileReference.loads("mingw_installer/1.0@conan/stable")]})]

self.assertEquals([tuple(a) for a in builds], expected)

def test_get_osx_apple_clang_builds(self):
Expand Down
43 changes: 33 additions & 10 deletions conan/test/packager_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def test_full_profile(self):
self.assertEquals(profile.options.as_list(), [("option1", "One")])
self.assertEquals(profile.env_values.data[None]["VAR_1"], "ONE")
self.assertEquals(profile.env_values.data[None]["VAR_2"], "TWO")
self.assertEquals(profile.build_requires["*"], [ConanFileReference.loads("myreference/1.0@lasote/testing")])
self.assertEquals(profile.build_requires["*"],
[ConanFileReference.loads("myreference/1.0@lasote/testing")])

def test_pages(self):
for number in range(10):
Expand Down Expand Up @@ -193,7 +194,9 @@ def test_assign_builds_retrocompatibility(self):
use_docker=True)
self.packager.add_common_builds()
self.packager.builds = [({"os": "Windows"}, {"option": "value"})]
self.assertEquals(self.packager.builds, [BuildConf(settings={'os': 'Windows'}, options={'option': 'value'}, env_vars={}, build_requires={})])
self.assertEquals(self.packager.builds, [BuildConf(settings={'os': 'Windows'},
options={'option': 'value'},
env_vars={}, build_requires={})])

def test_only_mingw(self):

Expand All @@ -202,16 +205,35 @@ def system(self):
return "Windows"

mingw_configurations = [("4.9", "x86_64", "seh", "posix")]
builder = ConanMultiPackager(mingw_configurations=mingw_configurations, visual_versions=[], username="Pepe", platform_info=PlatformInfoMock())
builder = ConanMultiPackager(mingw_configurations=mingw_configurations, visual_versions=[],
username="Pepe", platform_info=PlatformInfoMock())
builder.add_common_builds(shared_option_name="zlib:shared", pure_c=True)
expected = [({'compiler.libcxx': 'libstdc++', 'compiler.exception': 'seh', 'compiler.threads': 'posix', 'compiler.version': '4.9', 'arch': 'x86_64', 'build_type': 'Release', 'compiler': 'gcc'},
{'mingw_installer:threads': 'posix', 'mingw_installer:arch': 'x86_64', 'mingw_installer:version': '4.9', 'mingw_installer:exception': 'seh'},
expected = [({'compiler.exception': 'seh', 'compiler.libcxx': "libstdc++",
'compiler.threads': 'posix', 'compiler.version': '4.9', 'arch': 'x86_64',
'build_type': 'Release', 'compiler': 'gcc'},
{'zlib:shared': True},
{},
{'*': [ConanFileReference.loads("mingw_installer/0.1@lasote/testing")]}),
({'compiler.exception': 'seh', 'arch': 'x86_64', 'compiler.threads': 'posix', 'compiler.version': '4.9', 'compiler.libcxx': 'libstdc++', 'build_type': 'Debug', 'compiler': 'gcc'},
{'mingw_installer:threads': 'posix', 'mingw_installer:arch': 'x86_64', 'mingw_installer:version': '4.9', 'mingw_installer:exception': 'seh'},
{'*': [ConanFileReference.loads("mingw_installer/1.0@conan/stable")]}),
({'compiler.exception': 'seh', 'compiler.libcxx': "libstdc++", 'arch': 'x86_64',
'compiler.threads': 'posix', 'compiler.version': '4.9', 'build_type': 'Debug',
'compiler': 'gcc'},
{'zlib:shared': True},
{},
{'*': [ConanFileReference.loads("mingw_installer/0.1@lasote/testing")]})]
{'*': [ConanFileReference.loads("mingw_installer/1.0@conan/stable")]}),

({'compiler.exception': 'seh', 'compiler.libcxx': "libstdc++",
'compiler.threads': 'posix', 'compiler.version': '4.9', 'arch': 'x86_64',
'build_type': 'Release', 'compiler': 'gcc'},
{'zlib:shared': False},
{},
{'*': [ConanFileReference.loads("mingw_installer/1.0@conan/stable")]}),
({'compiler.exception': 'seh', 'compiler.libcxx': "libstdc++", 'arch': 'x86_64',
'compiler.threads': 'posix', 'compiler.version': '4.9', 'build_type': 'Debug',
'compiler': 'gcc'},
{'zlib:shared': False},
{},
{'*': [ConanFileReference.loads("mingw_installer/1.0@conan/stable")]})]

self.assertEquals([tuple(a) for a in builder.builds], expected)

def test_named_pages(self):
Expand Down Expand Up @@ -260,7 +282,8 @@ def system(self):
self.assertEquals(settings["compiler"], "Visual Studio")
self.assertEquals(settings["compiler.version"], "10")

with tools.environment_append({"CONAN_VISUAL_VERSIONS": "10", "MINGW_CONFIGURATIONS": "4.9@x86_64@seh@posix"}):
with tools.environment_append({"CONAN_VISUAL_VERSIONS": "10",
"MINGW_CONFIGURATIONS": "4.9@x86_64@seh@posix"}):
class PlatformInfoMock(object):
def system(self):
return "Windows"
Expand Down

0 comments on commit c823397

Please sign in to comment.