Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
slapos slapos
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 123
    • Merge requests 123
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedi
  • slaposslapos
  • Merge requests
  • !1108

Merged
Created Dec 20, 2021 by Kirill Smelkov@kirrOwner

Generalize how nxdtest python script is generated into pyprog recipe macro

  • Overview 8
  • Commits 2
  • Changes 2

In e328aa49 (component/nxdtest: Prepare for nxdtest!13 (merged)) I reworked how nxdtest script is generated and splitted it into nxdtest itself and .nxdtest.pyexe python interpreter, so that sys.executable could be used to correctly spawn other python scripts:

3) rework how nxdtest script is generated and split it into .nxdtest.pyexe and
   nxdtest itself. .nxdtest.pyexe is python interpreter via which nxdtest is run.
   This interpreter has all eggs required by nxdtest in sys.path, so that
   nxdtest could spawn its trun.py via sys.executable. If we don't care to have
   properly setup sys.executable, trun.py will fail when importing any module that
   nxdtest.py could already successfully import.

   Initially I tried to workaround this issue via adjusting $PYTHONPATH <-
   sys.path in main nxdtest script, but @jerome points out that, $PYTHONPATH,
   if set, also affects processes that trun.py spawns, which is not good:

   https://lab.nexedi.com/nexedi/slapos/merge_requests/1095#note_146799

   -> so fix this via running nxdtest via environment where sys.executable is
   properly setup python interpreter with path for all eggs that nxdtest has
   access to.

   Because we already have half-way workarounds for similar problem in several
   places, and because running a script with correctly setup sys.executable is
   generally better, I would say it should be a good idea to rework
   zc.recipe.egg:scripts to generate all scripts to work this way, but I do not
   want to fight about it.

   So let's leave this scheme nxdtest-specific for now.

This patch addresses the last paragraph and provides a general pyprog buildout macro that could be used to generate python script for any entry point to run with correctly set sys.executable.

/cc @jerome

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: y/pyprog
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7