fosslight-dependency 3.14.3__tar.gz → 3.15.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/PKG-INFO +1 -1
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/setup.py +1 -1
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/_package_manager.py +83 -16
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/package_manager/Android.py +12 -7
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency.egg-info/PKG-INFO +1 -1
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/LICENSE +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/LICENSES/Apache-2.0.txt +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/LICENSES/LicenseRef-3rd_party_licenses.txt +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/LICENSES/MIT.txt +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/MANIFEST.in +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/README.md +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/requirements.txt +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/setup.cfg +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/__init__.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/_analyze_dependency.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/_help.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/constant.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/package_manager/Carthage.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/package_manager/Cocoapods.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/package_manager/Go.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/package_manager/Gradle.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/package_manager/Helm.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/package_manager/Maven.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/package_manager/Npm.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/package_manager/Nuget.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/package_manager/Pub.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/package_manager/Pypi.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/package_manager/Swift.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/package_manager/Unity.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/package_manager/__init__.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/run_dependency_scanner.py +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency.egg-info/SOURCES.txt +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency.egg-info/dependency_links.txt +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency.egg-info/entry_points.txt +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency.egg-info/requires.txt +0 -0
- {fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency.egg-info/top_level.txt +0 -0
@@ -68,11 +68,12 @@ class PackageManager:
|
|
68
68
|
self.package_name = ''
|
69
69
|
|
70
70
|
def run_plugin(self):
|
71
|
+
ret = True
|
71
72
|
if self.package_manager_name == const.GRADLE or self.package_manager_name == const.ANDROID:
|
72
|
-
self.run_gradle_task()
|
73
|
+
ret = self.run_gradle_task()
|
73
74
|
else:
|
74
75
|
logger.info(f"This package manager({self.package_manager_name}) skips the step to run plugin.")
|
75
|
-
return
|
76
|
+
return ret
|
76
77
|
|
77
78
|
def append_input_package_list_file(self, input_package_file):
|
78
79
|
self.input_package_list_file.append(input_package_file)
|
@@ -87,35 +88,101 @@ class PackageManager:
|
|
87
88
|
pass
|
88
89
|
|
89
90
|
def run_gradle_task(self):
|
91
|
+
ret_task = True
|
90
92
|
if os.path.isfile(const.SUPPORT_PACKAE.get(self.package_manager_name)):
|
91
93
|
gradle_backup = f'{const.SUPPORT_PACKAE.get(self.package_manager_name)}_bk'
|
92
94
|
|
93
95
|
shutil.copy(const.SUPPORT_PACKAE.get(self.package_manager_name), gradle_backup)
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
96
|
+
ret_alldeps = self.add_allDeps_in_gradle()
|
97
|
+
|
98
|
+
ret_plugin = False
|
99
|
+
if (self.package_manager_name == const.ANDROID):
|
100
|
+
module_build_gradle = os.path.join(self.app_name, const.SUPPORT_PACKAE.get(self.package_manager_name))
|
101
|
+
module_gradle_backup = f'{module_build_gradle}_bk'
|
102
|
+
if os.path.isfile(module_build_gradle) and (not os.path.isfile(self.input_file_name)):
|
103
|
+
shutil.copy(module_build_gradle, module_gradle_backup)
|
104
|
+
ret_plugin = self.add_android_plugin_in_gradle(module_build_gradle)
|
105
|
+
|
106
|
+
if os.path.isfile('gradlew') or os.path.isfile('gradlew.bat'):
|
107
|
+
if self.platform == const.WINDOWS:
|
108
|
+
cmd_gradle = "gradlew.bat"
|
109
|
+
else:
|
110
|
+
cmd_gradle = "./gradlew"
|
111
|
+
else:
|
112
|
+
ret_task = False
|
113
|
+
logger.warning('No gradlew file exists. (skip to find dependencies relationship.')
|
114
|
+
if ret_plugin:
|
115
|
+
logger.warning('Also it cannot run android-dependency-scanning plugin.')
|
116
|
+
if ret_task:
|
117
|
+
if ret_alldeps:
|
118
|
+
cmd = f"{cmd_gradle} allDeps"
|
119
|
+
try:
|
104
120
|
ret = subprocess.check_output(cmd, shell=True, encoding='utf-8')
|
105
121
|
if ret != 0:
|
106
122
|
self.parse_dependency_tree(ret)
|
107
123
|
else:
|
108
124
|
self.set_direct_dependencies(False)
|
109
125
|
logger.warning("Failed to run allDeps task.")
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
126
|
+
except Exception as e:
|
127
|
+
self.set_direct_dependencies(False)
|
128
|
+
logger.error(f'Fail to run {cmd}: {e}')
|
129
|
+
logger.warning('It cannot print the direct/transitive dependencies relationship.')
|
130
|
+
|
131
|
+
if ret_plugin:
|
132
|
+
cmd = f"{cmd_gradle} generateLicenseTxt"
|
133
|
+
try:
|
134
|
+
ret = subprocess.check_output(cmd, shell=True, encoding='utf-8')
|
135
|
+
if ret == 0:
|
136
|
+
ret_task = False
|
137
|
+
logger.error(f'Fail to run {cmd}')
|
138
|
+
if os.path.isfile(self.input_file_name):
|
139
|
+
logger.info('Automatically run android-dependency-scanning plugin and generate output.')
|
140
|
+
self.plugin_auto_run = True
|
141
|
+
else:
|
142
|
+
logger.warning('Automatically run android-dependency-scanning plugin, but fail to generate output.')
|
143
|
+
except Exception as e:
|
144
|
+
logger.error(f'Fail to run {cmd}: {e}')
|
145
|
+
ret_task = False
|
114
146
|
|
115
147
|
if os.path.isfile(gradle_backup):
|
116
148
|
os.remove(const.SUPPORT_PACKAE.get(self.package_manager_name))
|
117
149
|
shutil.move(gradle_backup, const.SUPPORT_PACKAE.get(self.package_manager_name))
|
118
150
|
|
151
|
+
if (self.package_manager_name == const.ANDROID):
|
152
|
+
if os.path.isfile(module_gradle_backup):
|
153
|
+
os.remove(module_build_gradle)
|
154
|
+
shutil.move(module_gradle_backup, module_build_gradle)
|
155
|
+
return ret_task
|
156
|
+
|
157
|
+
def add_android_plugin_in_gradle(self, module_build_gradle):
|
158
|
+
ret = False
|
159
|
+
build_script = '''buildscript {
|
160
|
+
repositories {
|
161
|
+
mavenCentral()
|
162
|
+
}
|
163
|
+
dependencies {
|
164
|
+
//Android dependency scanning Plugin
|
165
|
+
classpath 'org.fosslight:android-dependency-scanning:+'
|
166
|
+
}
|
167
|
+
}'''
|
168
|
+
apply = "apply plugin: 'org.fosslight'\n"
|
169
|
+
try:
|
170
|
+
with open(const.SUPPORT_PACKAE.get(self.package_manager_name), 'r', encoding='utf-8') as original:
|
171
|
+
data = original.read()
|
172
|
+
with open(const.SUPPORT_PACKAE.get(self.package_manager_name), 'w', encoding='utf-8') as modified:
|
173
|
+
modified.write(f"{build_script}\n{data}")
|
174
|
+
ret = True
|
175
|
+
except Exception as e:
|
176
|
+
logging.warning(f"Cannot add the buildscript task in build.gradle: {e}")
|
177
|
+
|
178
|
+
try:
|
179
|
+
with open(module_build_gradle, 'a', encoding='utf-8') as modified:
|
180
|
+
modified.write(f'\n{apply}\n')
|
181
|
+
ret = True
|
182
|
+
except Exception as e:
|
183
|
+
logging.warning(f"Cannot add the apply plugin in {module_build_gradle}: {e}")
|
184
|
+
return ret
|
185
|
+
|
119
186
|
def add_allDeps_in_gradle(self):
|
120
187
|
ret = False
|
121
188
|
config = android_config if self.package_manager_name == 'android' else gradle_config
|
@@ -11,27 +11,32 @@ from fosslight_dependency._package_manager import PackageManager, get_url_to_pur
|
|
11
11
|
|
12
12
|
logger = logging.getLogger(constant.LOGGER_NAME)
|
13
13
|
|
14
|
-
_plugin_output_file = 'android_dependency_output.txt'
|
15
|
-
|
16
14
|
|
17
15
|
class Android(PackageManager):
|
18
16
|
package_manager_name = const.ANDROID
|
19
17
|
|
18
|
+
plugin_output_file = 'android_dependency_output.txt'
|
20
19
|
app_name = const.default_app_name
|
21
20
|
input_file_name = ''
|
21
|
+
plugin_auto_run = False
|
22
22
|
|
23
23
|
def __init__(self, input_dir, output_dir, app_name):
|
24
24
|
super().__init__(self.package_manager_name, '', input_dir, output_dir)
|
25
25
|
if app_name:
|
26
26
|
self.app_name = app_name
|
27
|
-
self.input_file_name = self.check_input_path(
|
27
|
+
self.input_file_name = self.check_input_path()
|
28
28
|
self.append_input_package_list_file(self.input_file_name)
|
29
29
|
|
30
|
-
def
|
31
|
-
if
|
32
|
-
|
30
|
+
def __del__(self):
|
31
|
+
if self.plugin_auto_run:
|
32
|
+
if os.path.isfile(self.input_file_name):
|
33
|
+
os.remove(self.input_file_name)
|
34
|
+
|
35
|
+
def check_input_path(self):
|
36
|
+
if os.path.isfile(self.plugin_output_file):
|
37
|
+
return self.plugin_output_file
|
33
38
|
else:
|
34
|
-
return os.path.join(app_name,
|
39
|
+
return os.path.join(self.app_name, self.plugin_output_file)
|
35
40
|
|
36
41
|
def parse_oss_information(self, f_name):
|
37
42
|
with open(f_name, 'r', encoding='utf8') as input_fp:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/__init__.py
RENAMED
File without changes
|
File without changes
|
{fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/_help.py
RENAMED
File without changes
|
{fosslight_dependency-3.14.3 → fosslight_dependency-3.15.0}/src/fosslight_dependency/constant.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|