Skip to content

Commit

Permalink
Fix output folder for conanworkspace.cmake when rebuilding dependenci…
Browse files Browse the repository at this point in the history
…es (conan-io#6060)

* Added required = True to subparsers in order to print error message in Py2 and Py3.

* sync

* basic concurrent upload at reference level with futures

* revert changes

* add line

* Lock buggy urllib3 (conan-io#5808)

* app simplifying (conan-io#5806)

* Apply lockfile before updating downstream requires (conan-io#5771)

* apply graph_lock before looking for overrides

* first step: get rid of the warning

* cleaner if graph_lock is passed to the function

* only update requires upstream if no lockfile is applied

* fix tests

* Deprecation of CONAN_USERNAME and CONAN_CHANNEL: fix error message (conan-io#5756)

* if CONAN_USERNAME and CONAN_CHANNEL are deprecated, the error cannot recommend them

* update tests accordingly

* test client load() file method (conan-io#5815)

* no user/channel repr without _ (conan-io#5817)

* no user/channel repr without _

* minor fixes

* fix tests

* Remove py34 (conan-io#5820)

* fix upload package id (conan-io#5824)

* - update macOS, watchOS, tvOS, iOS version numbers (conan-io#5823)

* Refresh token client support.  (conan-io#5662)

* Refresh token client support. Missing tests. Missing migration

* public method

* WIP

* Refresh almost there

* Removed prints

* Try migrate

* Migration

* Add comment

* Refresh token flow following RFC recommentations

* Refresh ok

* review

* Remove traces

* Refactor capabilities

* Removed tmp file

* Review

* conan-io#5819 Show warning message for Python 3.4 (conan-io#5829)

* conan-io#5819 Show warning message for Python 3.4

- Add new warning message for python 3.4 which is no longer supported
- Added funcional tests to validate both python 3.4 and 2.x

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* conan-io#5819 Fix broken tests

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Add cpp_info.name to cmake and pkg_config generators (conan-io#5598)

* Add cpp_info.name to cmake generators

* Fix unit tests to mimic real behavior

* cmake_paths test

* add test for cmake generator

* Add cmake_find_package test

* fix test in py3

* Applied cpp_info.name to pkg_config generator

* check different name in pkg_config

* sync with develop

* save conanworkspace.cmake relative to base folder

* add test

* siplify test

* add context manager to build folder

* change indent
  • Loading branch information
czoido authored and memsharded committed Dec 3, 2019
1 parent e0803c6 commit a2d1282
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 30 deletions.
58 changes: 29 additions & 29 deletions conans/client/installer.py
Expand Up @@ -191,35 +191,35 @@ def build_package(self, node, keep_build, recorder, remotes):
with package_layout.conanfile_read_lock(self._output):
_remove_folder_raising(package_folder)
mkdir(build_folder)
os.chdir(build_folder)
self._output.info('Building your package in %s' % build_folder)
try:
if getattr(conanfile, 'no_copy_source', False):
conanfile.source_folder = source_folder
else:
conanfile.source_folder = build_folder

if not skip_build:
with get_env_context_manager(conanfile):
conanfile.build_folder = build_folder
conanfile.package_folder = package_folder
# In local cache, install folder always is build_folder
conanfile.install_folder = build_folder
self._build(conanfile, pref, build_folder)
clean_dirty(build_folder)

prev = self._package(conanfile, pref, package_layout, conanfile_path, build_folder,
package_folder)
assert prev
node.prev = prev
log_file = os.path.join(build_folder, RUN_LOG_NAME)
log_file = log_file if os.path.exists(log_file) else None
log_package_built(pref, time.time() - t1, log_file)
recorder.package_built(pref)
except ConanException as exc:
recorder.package_install_error(pref, INSTALL_ERROR_BUILDING,
str(exc), remote_name=None)
raise exc
with tools.chdir(build_folder):
self._output.info('Building your package in %s' % build_folder)
try:
if getattr(conanfile, 'no_copy_source', False):
conanfile.source_folder = source_folder
else:
conanfile.source_folder = build_folder

if not skip_build:
with get_env_context_manager(conanfile):
conanfile.build_folder = build_folder
conanfile.package_folder = package_folder
# In local cache, install folder always is build_folder
conanfile.install_folder = build_folder
self._build(conanfile, pref, build_folder)
clean_dirty(build_folder)

prev = self._package(conanfile, pref, package_layout, conanfile_path, build_folder,
package_folder)
assert prev
node.prev = prev
log_file = os.path.join(build_folder, RUN_LOG_NAME)
log_file = log_file if os.path.exists(log_file) else None
log_package_built(pref, time.time() - t1, log_file)
recorder.package_built(pref)
except ConanException as exc:
recorder.package_install_error(pref, INSTALL_ERROR_BUILDING,
str(exc), remote_name=None)
raise exc

return node.pref

Expand Down
40 changes: 39 additions & 1 deletion conans/test/functional/workspace/workspace_test.py
Expand Up @@ -12,7 +12,7 @@
from conans.errors import ConanException
from conans.model.workspace import Workspace
from conans.test.utils.test_files import temp_folder
from conans.test.utils.tools import TestClient
from conans.test.utils.tools import TestClient, GenConanfile
from conans.util.files import load, save

conanfile_build = """from conans import ConanFile, CMake
Expand Down Expand Up @@ -1020,6 +1020,44 @@ class Lib(ConanFile):
self.assertTrue(os.path.exists(os.path.join(client.current_folder, "ws_install",
"conanworkspace.cmake")))

def test_install_folder_rebuilt_requirements(self):
# https://github.com/conan-io/conan/issues/6046
client = TestClient()
tool = dedent("""
from conans import ConanFile
class Tool(ConanFile):
def package_info(self):
self.cpp_info.libs = ["MyToolLib"]
""")
client.save({"conanfile.py": tool})
client.run("export . Tool/0.1@user/testing")
client.save({"conanfile.py": GenConanfile().with_name("HelloB").with_version("0.1")},
path=os.path.join(client.current_folder, "B"))
client.save({"conanfile.py": GenConanfile().with_name("HelloA").with_version(
"0.1").with_build_require_plain("Tool/0.1@user/testing").with_require_plain("HelloB/0.1")},
path=os.path.join(client.current_folder, "A"))

project = dedent("""
editables:
HelloB/0.1:
path: B
HelloA/0.1:
path: A
layout: layout
root: HelloA/0.1
workspace_generator: cmake
""")
layout = dedent("""
[build_folder]
build
""")
client.save({"conanws.yml": project,
"layout": layout})
client.run(
"workspace install conanws.yml --install-folder=ws_install --build Tool/0.1@user/testing")
self.assertTrue(os.path.exists(os.path.join(client.current_folder, "ws_install",
"conanworkspace.cmake")))

def missing_subarguments_test(self):
client = TestClient()
client.run("workspace", assert_error=True)
Expand Down

0 comments on commit a2d1282

Please sign in to comment.