From 259993b92aca26d1fe79e27a070e5c0c7e24f2c7 Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Fri, 9 Dec 2022 12:01:44 +0100 Subject: [PATCH 1/8] python-setup: Handle poetry `virtualenvs.options.no-pip = true` Fixes https://github.com/github/codeql-action/issues/1425 --- CHANGELOG.md | 2 +- python-setup/find_site_packages.py | 28 +++++++++++++++++++ python-setup/tests/from_python_exe.py | 3 +- .../tests/poetry/requests-3/poetry.toml | 3 ++ src/analyze.ts | 5 ++-- 5 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 python-setup/find_site_packages.py diff --git a/CHANGELOG.md b/CHANGELOG.md index ee808dd2b1..b06fd4442f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## [UNRELEASED] -No user facing changes. +- Python automatic dependency installation will no longer fail for projects using Poetry that specify `virtualenvs.options.no-pip = true` in their `poetry.toml`. [#1431](https://github.com/github/codeql-action/pull/1431). ## 2.1.38 - 12 Jan 2023 diff --git a/python-setup/find_site_packages.py b/python-setup/find_site_packages.py new file mode 100644 index 0000000000..a473ce66aa --- /dev/null +++ b/python-setup/find_site_packages.py @@ -0,0 +1,28 @@ +""" +Print the path to the site-packages directory for the current Python environment. +""" + +try: + import pip + import os + print(os.path.dirname(os.path.dirname(pip.__file__))) +except ImportError: + import sys + print("could not import pip", file=sys.stderr) + # if you use poetry with `virtualenvs.options.no-pip = true` you might end up with a + # virtualenv without pip, so the above trick doesn't actually work. See + # https://python-poetry.org/docs/configuration/#virtualenvsoptionsno-pip + # + # A possible option is to install `pip` into the virtualenv created by poetry + # (`poetry add pip`), but it turns out that doesn't always work :( for the test + # poetry/requests-3, I was not allowed to install pip! So I did not pursue this + # option further. + # + # Instead, local testing shows that first entry of `site.getsitepackages()` has the + # right path, whereas `site.getusersitepackages()` is about the system python (very + # confusing). + # + # We can't use the environment variable POETRY_VIRTUALENVS_OPTIONS_NO_PIP because it + # does not work, see https://github.com/python-poetry/poetry/issues/5906 + import site + print(site.getsitepackages()[0]) diff --git a/python-setup/tests/from_python_exe.py b/python-setup/tests/from_python_exe.py index 19702cf372..d5bf1624f7 100755 --- a/python-setup/tests/from_python_exe.py +++ b/python-setup/tests/from_python_exe.py @@ -9,8 +9,7 @@ def get_details(path_to_python_exe: str) -> Tuple[str, str]: import_path = subprocess.check_output( [ path_to_python_exe, - "-c", - "import os; import pip; print(os.path.dirname(os.path.dirname(pip.__file__)))", + os.path.join(os.path.dirname(__file__), "find_site_packages.py") ], stdin=subprocess.DEVNULL, ) diff --git a/python-setup/tests/poetry/requests-3/poetry.toml b/python-setup/tests/poetry/requests-3/poetry.toml index ab1033bd37..afbc8b90c1 100644 --- a/python-setup/tests/poetry/requests-3/poetry.toml +++ b/python-setup/tests/poetry/requests-3/poetry.toml @@ -1,2 +1,5 @@ [virtualenvs] in-project = true + +[virtualenvs.options] +no-pip = true diff --git a/src/analyze.ts b/src/analyze.ts index 00a72f21a7..629ea2e4d1 100644 --- a/src/analyze.ts +++ b/src/analyze.ts @@ -88,6 +88,8 @@ async function setupPythonExtractor(logger: Logger) { return; } + const scriptsFolder = path.resolve(__dirname, "../python-setup"); + let output = ""; const options = { listeners: { @@ -100,8 +102,7 @@ async function setupPythonExtractor(logger: Logger) { await new toolrunner.ToolRunner( codeqlPython, [ - "-c", - "import os; import pip; print(os.path.dirname(os.path.dirname(pip.__file__)))", + path.join(scriptsFolder, "find_site_packages.py"), ], options ).exec(); From 932b6a98b8b6f8b8e4484f1c8ef95fca7e3cdde4 Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Mon, 12 Dec 2022 18:00:32 +0100 Subject: [PATCH 2/8] python-setup: Fix path for tests --- python-setup/tests/from_python_exe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-setup/tests/from_python_exe.py b/python-setup/tests/from_python_exe.py index d5bf1624f7..79c423c1aa 100755 --- a/python-setup/tests/from_python_exe.py +++ b/python-setup/tests/from_python_exe.py @@ -9,7 +9,7 @@ def get_details(path_to_python_exe: str) -> Tuple[str, str]: import_path = subprocess.check_output( [ path_to_python_exe, - os.path.join(os.path.dirname(__file__), "find_site_packages.py") + os.path.join(os.path.dirname(__file__), "..", "find_site_packages.py") ], stdin=subprocess.DEVNULL, ) From ebf1b8f8fc422294ccb706270663f4caf877d311 Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Mon, 12 Dec 2022 18:00:46 +0100 Subject: [PATCH 3/8] Fix prettier problem --- src/analyze.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/analyze.ts b/src/analyze.ts index 629ea2e4d1..2bd630e28f 100644 --- a/src/analyze.ts +++ b/src/analyze.ts @@ -101,9 +101,7 @@ async function setupPythonExtractor(logger: Logger) { await new toolrunner.ToolRunner( codeqlPython, - [ - path.join(scriptsFolder, "find_site_packages.py"), - ], + [path.join(scriptsFolder, "find_site_packages.py")], options ).exec(); logger.info(`Setting LGTM_INDEX_IMPORT_PATH=${output}`); From b8107301d238fd9af508eb785e8c9ba6facb0259 Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Thu, 15 Dec 2022 15:36:43 +0100 Subject: [PATCH 4/8] python-setup: Fix for python2 --- python-setup/find_site_packages.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python-setup/find_site_packages.py b/python-setup/find_site_packages.py index a473ce66aa..8be77eb1bc 100644 --- a/python-setup/find_site_packages.py +++ b/python-setup/find_site_packages.py @@ -1,6 +1,7 @@ """ Print the path to the site-packages directory for the current Python environment. """ +from __future__ import print_function try: import pip From 2649b6603ab4d44a0b1bf5d08108fc0b81ab0fc3 Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Fri, 13 Jan 2023 11:23:43 +0100 Subject: [PATCH 5/8] python-setup: Fix site-packages selection without pip for Windows --- python-setup/find_site_packages.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python-setup/find_site_packages.py b/python-setup/find_site_packages.py index 8be77eb1bc..5be6bc6ce5 100644 --- a/python-setup/find_site_packages.py +++ b/python-setup/find_site_packages.py @@ -19,11 +19,12 @@ # poetry/requests-3, I was not allowed to install pip! So I did not pursue this # option further. # - # Instead, local testing shows that first entry of `site.getsitepackages()` has the - # right path, whereas `site.getusersitepackages()` is about the system python (very + # Instead, testing (on both Windows and Linux) shows that the last entry of + # `site.getsitepackages()` has the right path (note: On linux there is only a single + # entry), whereas `site.getusersitepackages()` is about the system python (very # confusing). # # We can't use the environment variable POETRY_VIRTUALENVS_OPTIONS_NO_PIP because it # does not work, see https://github.com/python-poetry/poetry/issues/5906 import site - print(site.getsitepackages()[0]) + print(site.getsitepackages()[-1]) From 2f6d17472d1d16ec18bd6ca923082f922169b4ee Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Fri, 13 Jan 2023 11:24:02 +0100 Subject: [PATCH 6/8] python-setup: Make debug printing more obvious --- python-setup/find_site_packages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-setup/find_site_packages.py b/python-setup/find_site_packages.py index 5be6bc6ce5..d894d088e8 100644 --- a/python-setup/find_site_packages.py +++ b/python-setup/find_site_packages.py @@ -9,7 +9,7 @@ print(os.path.dirname(os.path.dirname(pip.__file__))) except ImportError: import sys - print("could not import pip", file=sys.stderr) + print("DEBUG: could not import pip", file=sys.stderr) # if you use poetry with `virtualenvs.options.no-pip = true` you might end up with a # virtualenv without pip, so the above trick doesn't actually work. See # https://python-poetry.org/docs/configuration/#virtualenvsoptionsno-pip From 4bd9723e2bf5fe42aedbf40673efb06c4f1c1cd8 Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Thu, 15 Dec 2022 15:33:09 +0100 Subject: [PATCH 7/8] `npm run build` --- lib/analyze.js | 6 ++---- lib/analyze.js.map | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/analyze.js b/lib/analyze.js index e4bdf7b9ee..095060aaea 100644 --- a/lib/analyze.js +++ b/lib/analyze.js @@ -50,6 +50,7 @@ async function setupPythonExtractor(logger) { // If CODEQL_PYTHON is not set, no dependencies were installed, so we don't need to do anything return; } + const scriptsFolder = path.resolve(__dirname, "../python-setup"); let output = ""; const options = { listeners: { @@ -58,10 +59,7 @@ async function setupPythonExtractor(logger) { }, }, }; - await new toolrunner.ToolRunner(codeqlPython, [ - "-c", - "import os; import pip; print(os.path.dirname(os.path.dirname(pip.__file__)))", - ], options).exec(); + await new toolrunner.ToolRunner(codeqlPython, [path.join(scriptsFolder, "find_site_packages.py")], options).exec(); logger.info(`Setting LGTM_INDEX_IMPORT_PATH=${output}`); process.env["LGTM_INDEX_IMPORT_PATH"] = output; output = ""; diff --git a/lib/analyze.js.map b/lib/analyze.js.map index 7c29e66b28..8a89d34744 100644 --- a/lib/analyze.js.map +++ b/lib/analyze.js.map @@ -1 +1 @@ -{"version":3,"file":"analyze.js","sourceRoot":"","sources":["../src/analyze.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,2CAAyC,CAAC,6CAA6C;AAEvF,yEAA2D;AAC3D,8CAAsB;AACtB,8CAAgC;AAGhC,gEAAkD;AAClD,qCAAyE;AACzE,4DAA8C;AAE9C,2CAA0D;AAE1D,gEAAkD;AAClD,mDAAuD;AACvD,6CAA+B;AAE/B,MAAa,mBAAoB,SAAQ,KAAK;IAG5C,YAAY,mBAAwC,EAAE,OAAe;QACnE,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;IACjD,CAAC;CACF;AATD,kDASC;AAuDD,KAAK,UAAU,oBAAoB,CAAC,MAAc;IAChD,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAClD,IAAI,YAAY,KAAK,SAAS,IAAI,YAAY,CAA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AACpB,CAAC;AAZD,gCAYC;AAED,uBAAuB;AACvB,SAAgB,oBAAoB,CAAC,YAAwC;IAC3E,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,EAAE,CAAC;KACX;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;QAChC,MAAM,IAAI,KAAK,CACb,2EAA2E,OAAO,YAAY,EAAE,CACjG,CAAC;KACH;IAED,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,MAAM,EAAE,IAAI,YAAY,EAAE;QAC7B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC7B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;YACrB,MAAM,CAAC,IAAI,CACT,2CAA2C,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAChE,CAAC;SACH;QACD,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;YAC7C,MAAM,CAAC,IAAI,CACT,qDAAqD,IAAI,CAAC,SAAS,CACjE,EAAE,CACH,EAAE,CACJ,CAAC;SACH;KACF;IAED,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,0BAA0B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;KAChE;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAjCD,oDAiCC"} \ No newline at end of file +{"version":3,"file":"analyze.js","sourceRoot":"","sources":["../src/analyze.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,2CAAyC,CAAC,6CAA6C;AAEvF,yEAA2D;AAC3D,8CAAsB;AACtB,8CAAgC;AAGhC,gEAAkD;AAClD,qCAAyE;AACzE,4DAA8C;AAE9C,2CAA0D;AAE1D,gEAAkD;AAClD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,EAAE,CACH,EAAE,CACJ,CAAC;SACH;KACF;IAED,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,0BAA0B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;KAChE;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAjCD,oDAiCC"} \ No newline at end of file From 5ed1e985c26a7f2a05b632b2409982e10e070cf3 Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Fri, 13 Jan 2023 14:41:00 +0100 Subject: [PATCH 8/8] python-setup: Fix site-package selection for unix --- python-setup/find_site_packages.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/python-setup/find_site_packages.py b/python-setup/find_site_packages.py index d894d088e8..b73671df77 100644 --- a/python-setup/find_site_packages.py +++ b/python-setup/find_site_packages.py @@ -19,12 +19,16 @@ # poetry/requests-3, I was not allowed to install pip! So I did not pursue this # option further. # - # Instead, testing (on both Windows and Linux) shows that the last entry of - # `site.getsitepackages()` has the right path (note: On linux there is only a single - # entry), whereas `site.getusersitepackages()` is about the system python (very - # confusing). + # Instead, testing `site.getsitepackages()` contains has the right path, whereas + # `site.getusersitepackages()` is about the system python (very confusing). # # We can't use the environment variable POETRY_VIRTUALENVS_OPTIONS_NO_PIP because it # does not work, see https://github.com/python-poetry/poetry/issues/5906 import site - print(site.getsitepackages()[-1]) + + if sys.platform.startswith("win32"): + # On windows, the last entry of `site.getsitepackages()` has the right path + print(site.getsitepackages()[-1]) + else: + # on unix, the first entry of `site.getsitepackages()` has the right path + print(site.getsitepackages()[0])