Repository: lucidsushi/gs_pip_install

Issue:
Path error when specifying extras
https://github.com/lucidsushi/gs_pip_install/blob/09668ce1fe393dc338b5b3f3181f76bd44891e74/gs_pip_install/gs_pip_install.py#L79

Currently a list of lists is created - will raise:

ERROR: Invalid requirement: 'gcs_packages/geotab_data_factory.tar.gz[[pipelines]]'
Hint: It looks like a path. File 'gcs_packages/geotab_data_factory.tar.gz[[pipelines]]' does not exist.

Replace to `install_path = f"{install_path}{extras[package]}`


Discussion:

Patch:
diff --git a/gs_pip_install/gs_pip_install.py b/gs_pip_install/gs_pip_install.py
index 1313713..3bc6d66 100644
--- a/gs_pip_install/gs_pip_install.py
+++ b/gs_pip_install/gs_pip_install.py
@@ -76,7 +76,7 @@ def install_packages(
         package, *_ = gs_package_zip_file.split('.')
         install_path = f"{packages_download_dir}/{gs_package_zip_file}"
         if extras.get(package):
-            install_path = f"{install_path}[{extras[package]}]"
+            install_path = f"{install_path}{extras[package]}"
 
         if not target_dir:
             install_command = [


Test patch:
diff --git a/tests/test_gs_pip_install.py b/tests/test_gs_pip_install.py
index c468e7a..a03a95f 100644
--- a/tests/test_gs_pip_install.py
+++ b/tests/test_gs_pip_install.py
@@ -147,7 +147,7 @@ class TestInstall(unittest.TestCase):
         mock_list_dir.return_value = ['some_package.tar.gz']
         gs_pip_install.install_packages(
             packages_download_dir='some_download_dest',
-            extras={'some_package': 'extra_a, extra_b'},
+            extras={'some_package': '[extra_a, extra_b]'},
         )
         mock_subprocess.assert_called_once_with(
             [
@@ -160,3 +160,13 @@ class TestInstall(unittest.TestCase):
                 "some_download_dest/some_package.tar.gz[extra_a, extra_b]",
             ]
         )
+
+    def test_strip_extras(self):
+
+        # fmt: off
+        assert gs_pip_install._strip_extras(
+            'some_package.tar.gz[extra_a, extra_b]'
+        ) == (
+            'some_package.tar.gz', '[extra_a, extra_b]'
+        )
+        # fmt: on