mayk
mayk

Reputation: 41

pyside6-deploy keeps rewriting python_path in pysidedeploy.spec

The documentation of pyside6-deploy suggests, that you shall use a virtual environment. So I got started with

pipenv install pyside6

Inside that environment, pyside6-deploy runs without errors. Just like the documentation suggests, I want to keep the pysidedeploy.spec file in version control. BUT every time I execute pyside6-deploy it keeps rewriting the line starting with 'python_path = ' with an absolute path that only makes sense on the local machine but not in any rcs repository.

I looked up command line arguments that might command to keep the original spec file. Found none.

Assuming that it is required to have any python_path set, the best way I could think about is to replace the explicit absolute python_path with a query

pipenv -q --py

which yields the exact same value but would be agnostic of the exact host it is running on.

I read the spec file documentation carefully to find if it supports interpolation like $(pipenv -q --py). Additionally searched for this feature on the web and fuzzed the spec file if any warning or error message indicates support of interpolation. To no avail.

Has anyone got experience how to handle pyside6-deploy in that manner? Any wild thoughts on this? Any strategic considerations are welcome as long as usage of PySide6 is not questioned.

Upvotes: 1

Views: 215

Answers (1)

Vijay Panwar
Vijay Panwar

Reputation: 273

I like your idea of approaching ising pipenv to generate the platform-agnostic python-path. But pyside6-deploy doesn't support interpolation in the .spec file.

Here is some ideas.

  1. Use a relative path: instead of absolute path, try setting python_path to a relative path, such as . or ./venv/bin/python. This might allow the .spec file to be more portable across different machines.
  2. Create a separate spec file for each environment, if you have multiple environments you could keep .spec file for each.
  3. Use a template engine like Jinja2 or Mustache to generate the .spec file dynamically.

Note: always keep your .spec file under version control, so you can track changes and collaborate with others.

Upvotes: 0

Related Questions