Skip to content

Commit fcffb1b

Browse files
Conan2 migration (#40)
* Disable scanning of Conan packages due to bug of Pivotal License Finder * Set version to 1.3.0
1 parent 687a38f commit fcffb1b

File tree

4 files changed

+41
-15
lines changed

4 files changed

+41
-15
lines changed

NOTICE-3RD-PARTY-CONTENT.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
## Python
44
| Dependency | Version | License |
55
|:-----------|:-------:|--------:|
6-
|certifi|2025.1.31|Mozilla Public License 2.0|
7-
|charset-normalizer|3.4.1|MIT|
6+
|certifi|2025.4.26|Mozilla Public License 2.0|
7+
|charset-normalizer|3.4.2|MIT|
88
|gitdb|4.0.12|BSD|
99
|GitPython|3.1.44|New BSD|
1010
|idna|3.10|BSD|
1111
|PyYAML|6.0.2|MIT|
1212
|requests|2.32.3|Apache 2.0|
1313
|smmap|5.0.2|New BSD|
1414
|str2bool|1.1|BSD|
15-
|types-PyYAML|6.0.12.20241230|Apache 2.0|
16-
|types-requests|2.32.0.20250306|Apache 2.0|
15+
|types-pyyaml|6.0.12.20250402|unknown|
16+
|types-requests|2.32.0.20250328|Apache 2.0|
1717
|urllib3|2.0.7|MIT|
1818
## Workflows
1919
| Dependency | Version | License |

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Dependencies are detected using the respective languages' package manager.
66
## Supported Languages
77

88
* Python3 via pip
9-
* CPP via Conan
9+
* CPP via Conan (currently disabled due to bugs in Pivotal License Finder, see below)
1010
* Rust via Cargo
1111
* JavaScript via NPM
1212

@@ -104,7 +104,14 @@ scan-dirs:
104104

105105
### Limitations
106106

107-
The currently used version (v7.0.1) of the Pivotal License Finder has limited support for the Conan Package Manager:
107+
The support of the Conan C++ package manager is disabled for time being:
108+
109+
The currently used version (v7.2.1) of the Pivotal License Finder basically does support Conan 2 but has a bug
110+
(https://github.com/pivotal/LicenseFinder/issues/1057) reuslting in an endless loop while scanning a directory
111+
containing a conanfile which is Connan 2 based. That's the reason while we currently have completely commented out
112+
the call of that part of the finder (file src/licensevalidator/findlicenses.py).
113+
114+
The previously used version (v7.0.1) of the Pivotal License Finder has limited support for the Conan Package Manager:
108115
* No direct support of conanfile.py; as a workaround you can add an empty conanfile.txt aside of your conanfile.py.
109116
* It expects a file called "LICENSE*" in some subfolder of the package. If this is not present the scan will fail.
110117
* It internally uses "conan install" to determine the dependencies, which tries to download those from Conan-Center.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
setuptools.setup(
2424
name="licensevalidator",
25-
version="1.2.6",
25+
version="1.3.0",
2626
description="A validator for dependency licenses",
2727
long_description=long_description,
2828
long_description_content_type="text/markdown",

src/licensevalidator/findlicenses.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,23 @@ def __use_conan_profile_if_present(conan_profile_file: str):
112112
f'Failed to use Conan profile file "{conan_profile_file}"!'
113113
)
114114

115+
conan2_home_dir = os.environ.get("CONAN_HOME")
116+
if not conan2_home_dir:
117+
conan2_home_dir = os.environ.get("HOME")
118+
if not conan2_home_dir:
119+
conan2_home_dir = "/root"
120+
os.path.join(conan2_home_dir, ".conan2")
121+
conan2_default_profile_file = os.path.join(
122+
conan2_home_dir, "profiles", "default"
123+
)
124+
125+
os.makedirs(os.path.dirname(conan2_default_profile_file), exist_ok=True)
126+
shutil.copyfile(conan_profile_file, conan2_default_profile_file)
127+
if not os.path.isfile(conan2_default_profile_file):
128+
raise FileNotFoundError(
129+
f'Failed to use Conan2 profile file "{conan_profile_file}"!'
130+
)
131+
115132

116133
def sort_dependencies(deps: list[DependencyInfo]) -> list[DependencyInfo]:
117134
"""Sort the passed DependencyInfo list by name 1st and version 2nd
@@ -167,14 +184,16 @@ def find_licenses(
167184
package_managers=["cargo"],
168185
),
169186
),
170-
(
171-
"c++",
172-
lambda config: __get_cpp_licenses(
173-
project_root,
174-
config.get("path"),
175-
config.get("cpp-conan-included-profile-files"),
176-
),
177-
),
187+
# Disable Conan scan - not working yet - enable once fixed
188+
# GitHub issue: https://github.com/pivotal/LicenseFinder/issues/1057
189+
# (
190+
# "c++",
191+
# lambda config: __get_cpp_licenses(
192+
# project_root,
193+
# config.get("path"),
194+
# config.get("cpp-conan-included-profile-files"),
195+
# ),
196+
# ),
178197
(
179198
"JavaScript",
180199
lambda config: execute_license_finder(

0 commit comments

Comments
 (0)