Skip to content

Commit 51b5263

Browse files
committed
Fix an issue with comments in requirements.txt
1 parent 1c3ba3d commit 51b5263

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

python/scriptingprovider.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,8 +1218,10 @@ def _install_modules(self, ctx, _modules: bytes) -> bool:
12181218
dependencies_json = json.loads(_modules.decode("utf-8"))
12191219
modules = ""
12201220
if "pip" in dependencies_json:
1221-
modules = dependencies_json["pip"]
1222-
if len(modules.strip()) == 0:
1221+
if len(dependencies_json["pip"].strip()) == 0:
1222+
return True
1223+
modules = [line.split('#', 1)[0].strip() for line in dependencies_json["pip"].split('\n') if line.split('#', 1)[0].strip()]
1224+
if len(modules) == 0:
12231225
return True
12241226
python_lib = settings.Settings().get_string("python.interpreter")
12251227
python_bin_override = settings.Settings().get_string("python.binaryOverride")
@@ -1267,7 +1269,7 @@ def _install_modules(self, ctx, _modules: bytes) -> bool:
12671269
) / f"python{sys.version_info.major}{sys.version_info.minor}" / "site-packages"
12681270
site_package_dir.mkdir(parents=True, exist_ok=True)
12691271
args.extend(["--target", str(site_package_dir)])
1270-
args.extend(list(filter(len, modules.split("\n"))))
1272+
args.extend(list(filter(len, modules)))
12711273
logger.log_info(f"Running pip {args}")
12721274
status, result = self._run_args(args, env=python_env)
12731275
if status:

0 commit comments

Comments
 (0)