diff options
| author | Can Eldem <celdem@gitlab.com> | 2020-04-06 11:59:02 +0000 |
|---|---|---|
| committer | Can Eldem <celdem@gitlab.com> | 2020-04-06 11:59:02 +0000 |
| commit | dda9e59a4a3ab471001998d0e68d67ab12b4ac69 (patch) | |
| tree | ad7b589d18aec83d4f09d0e64b75e1581c85589b /lib/license/finder/ext | |
| parent | 93a00df11d79c9f59141ff42ce05ab3b3d329375 (diff) | |
| parent | 93f7c568e1104936de011626d3bd7f56ebe66355 (diff) | |
Merge branch 'maven-airgap' into 'master'v3.7.0
Install certificate bundle.
See merge request gitlab-org/security-products/license-management!126
Diffstat (limited to 'lib/license/finder/ext')
| -rw-r--r-- | lib/license/finder/ext/go_modules.rb | 4 | ||||
| -rw-r--r-- | lib/license/finder/ext/pip.rb | 4 | ||||
| -rw-r--r-- | lib/license/finder/ext/pipenv.rb | 15 | ||||
| -rw-r--r-- | lib/license/finder/ext/shared_helpers.rb | 7 |
4 files changed, 14 insertions, 16 deletions
diff --git a/lib/license/finder/ext/go_modules.rb b/lib/license/finder/ext/go_modules.rb index 2ef3aa2..d86f21a 100644 --- a/lib/license/finder/ext/go_modules.rb +++ b/lib/license/finder/ext/go_modules.rb @@ -25,10 +25,6 @@ module LicenseFinder private - def shell - @shell ||= ::License::Management::Shell.new - end - def absolute_project_path @absolute_project_path ||= Pathname(project_path).cleanpath end diff --git a/lib/license/finder/ext/pip.rb b/lib/license/finder/ext/pip.rb index a55dba7..5ef6602 100644 --- a/lib/license/finder/ext/pip.rb +++ b/lib/license/finder/ext/pip.rb @@ -51,10 +51,6 @@ module LicenseFinder Dir.chdir(project_path) { yield } end - def shell - @shell ||= ::License::Management::Shell.new - end - def pypi @pypi ||= Spandx::Python::PyPI.new(sources: [ Spandx::Python::Source.new({ diff --git a/lib/license/finder/ext/pipenv.rb b/lib/license/finder/ext/pipenv.rb index 075ddd9..d681cc2 100644 --- a/lib/license/finder/ext/pipenv.rb +++ b/lib/license/finder/ext/pipenv.rb @@ -5,8 +5,8 @@ module LicenseFinder def prepare return unless pipfile? - shell.execute([:pipenv, '--python', python.version]) - shell.execute([:pipenv, :run, :pipenv, :sync, '--pypi-mirror', python.pip_index_url]) + shell.execute([:pipenv, '--python', python.version], env: default_env) + shell.execute([:pipenv, :run, :pipenv, :sync, '--pypi-mirror', python.pip_index_url], env: default_env) end def current_packages @@ -17,10 +17,6 @@ module LicenseFinder private - def shell - @shell ||= ::License::Management::Shell.new - end - def python @python ||= ::License::Management::Python.new end @@ -52,5 +48,12 @@ module LicenseFinder def lockfile_hash @lockfile_hash ||= JSON.parse(IO.read(detected_package_path)) end + + def default_env + return {} unless shell.custom_certificate_installed? + return {} if ENV['PIP_CERT'] + + { 'PIP_CERT' => shell.custom_certificate_path.to_s } + end end end diff --git a/lib/license/finder/ext/shared_helpers.rb b/lib/license/finder/ext/shared_helpers.rb index cee79ab..c3d6319 100644 --- a/lib/license/finder/ext/shared_helpers.rb +++ b/lib/license/finder/ext/shared_helpers.rb @@ -2,10 +2,13 @@ module LicenseFinder module SharedHelpers + def shell + ::License::Management.shell + end + class Cmd def self.run(command) - @shell ||= ::License::Management::Shell.new - @shell.execute(command) + ::License::Management.shell.execute(command) end end end |
