whenever it is an SCM attribute, evaluate it
@@ -68,12 +68,17 @@ def _capture_export_scm_data(conanfile, conanfile_dir, destination_folder, outpu
os.unlink(scm_src_file)
scm_data = get_scm_data(conanfile)
- captured_revision = scm_data.capture_revision if scm_data else False
+ if not scm_data:
+ return None, False
- if not scm_data or not (scm_data.capture_origin or scm_data.capture_revision):
- return None, captured_revision
+ # Resolve SCMData in the user workspace (someone may want to access CVS or import some py)
+ captured_revision = scm_data.capture_revision
scm = SCM(scm_data, conanfile_dir, output)
+ if scm_data.capture_origin or scm_data.capture_revision:
+ # Generate the scm_folder.txt file pointing to the src_path
+ src_path = scm.get_repo_root()
+ save(scm_src_file, src_path.replace("\\", "/"))
if scm_data.url == "auto":
origin = scm.get_qualified_remote_url()
@@ -83,17 +88,14 @@ def _capture_export_scm_data(conanfile, conanfile_dir, destination_folder, outpu
output.warn("Repo origin looks like a local path: %s" % origin)
output.success("Repo origin deduced by 'auto': %s" % origin)
scm_data.url = origin
+
if scm_data.revision == "auto":
if not scm.is_pristine():
output.warn("Repo status is not pristine: there might be modified files")
scm_data.revision = scm.get_revision()
output.success("Revision deduced by 'auto': %s" % scm_data.revision)
- # Generate the scm_folder.txt file pointing to the src_path
- src_path = scm.get_repo_root()
- save(scm_src_file, src_path.replace("\\", "/"))
- _replace_scm_data_in_conanfile(os.path.join(destination_folder, "conanfile.py"),
- scm_data)
+ _replace_scm_data_in_conanfile(os.path.join(destination_folder, "conanfile.py"), scm_data)
return scm_data, captured_revision
@@ -145,7 +147,6 @@ def _replace_scm_data_in_conanfile(conanfile_path, scm_data):
content = content if not headers else ''.join(headers) + content
save(conanfile_path, content)
-
def _export_conanfile(conanfile_path, output, client_cache, conanfile, conan_ref, keep_source):
exports_folder = client_cache.export(conan_ref)
