Sitelet https://web.archive.org/web/20220706232232/https://github.com/github/codeql/issues/9713
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LGTM.com - 3.10 is not a valid value for LGTM_PYTHON_SETUP_VERSION #9713

Open
igo95862 opened this issue Jun 25, 2022 · 4 comments
Open

LGTM.com - 3.10 is not a valid value for LGTM_PYTHON_SETUP_VERSION #9713

igo95862 opened this issue Jun 25, 2022 · 4 comments

Comments

@igo95862
Copy link

@igo95862 igo95862 commented Jun 25, 2022

I am trying to make LGTM.com to use Python 3.10 instead of 3.8 because in
3.9 ArgumentParser.__init__ gained a new keyword exit_on_error but LGTM is not recognizing that.

This is my lgtm.yml

---

extraction:
  python:
    python_setup:
      version: '3.10'

This is the error I get on LGTM:

[2022-06-23 15:57:38] [build-stderr] SyntaxError: Illegal value for LGTM_PYTHON_SETUP_VERSION
[2022-06-23 15:57:38] [build-stdout] index:
[2022-06-23 15:57:39] [build-stderr] Traceback (most recent call last):
[2022-06-23 15:57:39] [build-stderr]   File "/opt/dist/python/tools/index.py", line 25, in <module>
[2022-06-23 15:57:39] [build-stderr]     buildtools.index.main()
[2022-06-23 15:57:39] [build-stderr]   File "/home/runner/work/semmle-code/semmle-code/target/thirdparty/python/build/extractor-python/buildtools/index.py", line 354, in main
[2022-06-23 15:57:39] [build-stderr]     
[2022-06-23 15:57:39] [build-stderr]   File "/home/runner/work/semmle-code/semmle-code/target/thirdparty/python/build/extractor-python/buildtools/discover.py", line 58, in get_version
[2022-06-23 15:57:39] [build-stderr]   File "/home/runner/work/semmle-code/semmle-code/target/thirdparty/python/build/extractor-python/buildtools/version.py", line 144, in best_version
[2022-06-23 15:57:39] [build-stderr] SyntaxError: Illegal value for LGTM_PYTHON_SETUP_VERSION
[2022-06-23 15:57:39] [ERROR] Spawned process exited abnormally (code 1; tried to run: [/opt/work/lgtm-workspace/lgtm/extract.sh])
@aibaars
Copy link
Contributor

@aibaars aibaars commented Jun 26, 2022 •

The python_setup.version field only allows 2 or 3 . It's purpose is to indicate to the CodeQL analyzer whether the code should be analyzed as Python 2 or Python 3.

I think you can achieve what you want you could try installing python 3.9 from https://downloads.python.org/pypy/ , unpack it and put the bin directory on the PATH before the setup_python step is run. I think the following should work:

extraction:
  python:
    after_prepare:
      - wget https://downloads.python.org/pypy/pypy3.9-v7.3.9-linux64.tar.bz2 -O"${LGTM_WORKSPACE}/python3.9.tar.bz2"
      - tar -C "${LGTM_WORKSPACE}" -xjf "${LGTM_WORKSPACE}/python3.9.tar.bz2" 
      - PATH="${LGTM_WORKSPACE}/pypy3.9-v7.3.9-linux64/bin:$PATH"

Note: you can use the `Test analysis configuration" button to try out configuration changes, see:

@mehdialiakbar31
Copy link

@mehdialiakbar31 mehdialiakbar31 commented Jun 26, 2022

I am trying to make LGTM.com to use Python 3.10 instead of 3.8 because in 3.9 ArgumentParser.__init__ gained a new keyword exit_on_error but LGTM is not recognizing that.

This is my lgtm.yml

---

extraction:
  python:
    python_setup:
      version: '3.10'

This is the error I get on LGTM:

[2022-06-23 15:57:38] [build-stderr] SyntaxError: Illegal value for LGTM_PYTHON_SETUP_VERSION
[2022-06-23 15:57:38] [build-stdout] index:
[2022-06-23 15:57:39] [build-stderr] Traceback (most recent call last):
[2022-06-23 15:57:39] [build-stderr]   File "/opt/dist/python/tools/index.py", line 25, in <module>
[2022-06-23 15:57:39] [build-stderr]     buildtools.index.main()
[2022-06-23 15:57:39] [build-stderr]   File "/home/runner/work/semmle-code/semmle-code/target/thirdparty/python/build/extractor-python/buildtools/index.py", line 354, in main
[2022-06-23 15:57:39] [build-stderr]     
[2022-06-23 15:57:39] [build-stderr]   File "/home/runner/work/semmle-code/semmle-code/target/thirdparty/python/build/extractor-python/buildtools/discover.py", line 58, in get_version
[2022-06-23 15:57:39] [build-stderr]   File "/home/runner/work/semmle-code/semmle-code/target/thirdparty/python/build/extractor-python/buildtools/version.py", line 144, in best_version
[2022-06-23 15:57:39] [build-stderr] SyntaxError: Illegal value for LGTM_PYTHON_SETUP_VERSION
[2022-06-23 15:57:39] [ERROR] Spawned process exited abnormally (code 1; tried to run: [/opt/work/lgtm-workspace/lgtm/extract.sh])

@igo95862
Copy link
Author

@igo95862 igo95862 commented Jun 26, 2022 •

The python_setup.version field only allows 2 or 3 . It's purpose is to indicate to the CodeQL analyzer whether the code should be analyzed as Python 2 or Python 3.

I think you can achieve what you want you could try installing python 3.9 from https://downloads.python.org/pypy/ , unpack it and put the bin directory on the PATH before the setup_python step is run. I think the following should work:

extraction:
  python:
    after_prepare:
      - wget https://downloads.python.org/pypy/pypy3.9-v7.3.9-linux64.tar.bz2 -O"${LGTM_WORKSPACE}/python3.9.tar.bz2"
      - tar -xjf "${LGTM_WORKSPACE}/python3.9.tar.bz2"
      - PATH="${LGTM_WORKSPACE}/pypy3.9-v7.3.9-linux64/bin:$PATH"

Note: you can use the `Test analysis configuration" button to try out configuration changes, see:

* https://lgtm.com/projects/g/igo95862/bubblejail/logs/languages/lang:python

* https://lgtm.com/logs/71e081a586508b25a6f149ef299863474b59f4de/lang:python

Thanks. I will look in to this.

Do you know what distro LGTM is running on? Is it Ubuntu 20.04? (I am going to try a PPA for ubuntu with more recent python package)

@aibaars
Copy link
Contributor

@aibaars aibaars commented Jun 26, 2022

Thanks. I will look in to this.

Note I forgot a -C $LGTM_WORKSPACE flag in the tar command above.

Do you know what distro LGTM is running on? Is it Ubuntu 20.04? (I am going to try a PPA for ubuntu with more recent python package)

I think it is 20.04, but I'm not sure LGTM permits adding any PPA. Still worth a try though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants