Commit 6f167c36 authored by Jérome Perrin's avatar Jérome Perrin

software/theia: enable user installation of pip packages

this can be used to install linters such as pylint when the python
extension prompts for it

also add ~/.local/bin in user $PATH to prevent warning and to be
able to use pip installed packages from the shell.
parent f4088ea3
...@@ -148,6 +148,7 @@ content = ...@@ -148,6 +148,7 @@ content =
"editor.tabSize": 2, "editor.tabSize": 2,
"plantuml.server": "https://plantuml.host.vifib.net/svg/", "plantuml.server": "https://plantuml.host.vifib.net/svg/",
"plantuml.render": "PlantUMLServer", "plantuml.render": "PlantUMLServer",
"python.pythonPath": "${python:executable}",
"gitlens.remotes": [{ "domain": "lab.nexedi.com", "type": "GitLab" }] "gitlens.remotes": [{ "domain": "lab.nexedi.com", "type": "GitLab" }]
}, },
"warnOnPotentiallyInsecureHostPattern": false "warnOnPotentiallyInsecureHostPattern": false
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
[instance-theia] [instance-theia]
_update_hash_filename_ = instance-theia.cfg.jinja.in _update_hash_filename_ = instance-theia.cfg.jinja.in
md5sum = 09bc1d148aac1b8a5ea3e479884c4374 md5sum = 5c54749b4cbfd2166f8813f8da62c4c5
[instance] [instance]
_update_hash_filename_ = instance.cfg.in _update_hash_filename_ = instance.cfg.in
......
...@@ -11,6 +11,7 @@ theia-environment-parts = ...@@ -11,6 +11,7 @@ theia-environment-parts =
slapos-repository slapos-repository
runner-link runner-link
settings.json settings.json
python-enable-user-pip
theia-parts = theia-parts =
frontend-instance frontend-instance
...@@ -407,7 +408,7 @@ output = $${directory:bin}/$${:_buildout_section_name_} ...@@ -407,7 +408,7 @@ output = $${directory:bin}/$${:_buildout_section_name_}
inline = inline =
#!/bin/sh #!/bin/sh
export HOME=$${directory:home} export HOME=$${directory:home}
export PATH=${cli-utilities:PATH}:$HOME/.cargo/bin:$PATH export PATH=${cli-utilities:PATH}:$HOME/.cargo/bin:$HOME/.local/bin:$PATH
export IPV6_SLAPRUNNER={{ ipv6_random }} export IPV6_SLAPRUNNER={{ ipv6_random }}
# Theia Backend # Theia Backend
...@@ -493,6 +494,12 @@ command = ...@@ -493,6 +494,12 @@ command =
${buildout:bin-directory}/slapos complete > $${directory:bash-completions}/slapos ${buildout:bin-directory}/slapos complete > $${directory:bash-completions}/slapos
${buildout:bin-directory}/slapos complete --shell fish > $${directory:fish-completions}/slapos.fish ${buildout:bin-directory}/slapos complete --shell fish > $${directory:fish-completions}/slapos.fish
[python-enable-user-pip]
# enable pip user installation for python extension
recipe = plone.recipe.command
stop-on-error = true
command =
${python:executable} -m ensurepip --user
# Embedded Instance # Embedded Instance
# ----------------- # -----------------
......
  • @jerome

    I think this change is actually problematic because python always looks for the user site-packages, so every time a python is launched in Theia it has ~/.local/../sites-packages in its path. This means every Python launched by an instance inside Theia is potentially affected by what's installed there, even when it's a Python built for the instance, not just for the Python available in Theia terminal.

    Or perhaps alternatively, every script and interpreter generated by an SR should add -s or -S to its python shebang to ignore site packages entirely ?

    Anyway, I just noticed this while trying to launch buildout tests inside Theia using the buildout-testing SR, with which user site-packages interfered.

    Edited by Xavier Thompson
  • mentioned in commit ec4f2c22

    Toggle commit list
  • @xavier_thompson I also found strange behaviors myself, @tomo also reported earlier in !1341 (merged) , let's revert. I did !1464 (merged) , there was a new theia version and something I wanted to try for the restart issue.

    PS: are you able to run buildout tests ? yesterday I sent a quick pull request to fix something minor in the docs and upstream buildout tests seem to fail on master https://github.com/buildout/buildout/pull/633/checks . I did not look in details, but my guess is that this test uses the latest setuptools and something became incompatible.

  • Ok :)

    I am able to run the buildout tests for our current patch on buildout 2.7.1, I haven't managed to run the tests for upstream buildout yet. I have similar guesses.

Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment