-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
support setting environment variables #198
base: master
Are you sure you want to change the base?
Conversation
Does npm support something similar? |
None that I can think of. |
I can't check now, but I remember when I checked some years ago, there were some references to passing configuration via shell environment variables. I think that generally we should remain consistent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you pass npm options, for example, npm --build-from-source
- these will be made available to the action script in its environments as npm_config_build_from_source=true
. Maybe it was this?
The problem does not have a generic solution: There are a number of npm packages that do this for plain npm actions. |
Can you elaborate on the rationale behind this proposal? Do you have a use case that you can share? |
I am trying to reduce the complexity of https://github.com/mmomtchev/magickwand.js/blob/meson/package.json Clean cross-platform method for setting the environment variables will help a lot. I am installing custom versions of |
I see. Pretty hard to read. :-( Can you provide a similar package.json using your solution, to see the improvement?
Aha. So the goal is to define a method for setting environment variables to be consumed by tools invoked in actions. I have to think about it. |
BTW, as far as I understood it, the philosophy of npm is to unify all platforms by bringing links to all dependencies in the This generally works fine, except on Windows, where Seeing your use case, with lots of platform specific separate definitions, made me wonder what can be done for it to benefit from a similar unifying approach? Would a mechanism for setting environment variables be enough? |
Another solution that I was thinking of was a |
This solution is both a blessing and a curse. It is a blessing since it made npm on Windows possible, compensating for the lack of links to files. It is a curse since it requires the shell. For npm/xpm this is not a problem, but otherwise it is a nuisance, like having to explicitly suffix the command name with
Right. And this is one aspect where your proposal makes things a bit cleaner.
Yeah, possibly. There is a BTW, in the npm world there is also a portable shell ( |
Alas, However |
Nice! Can you share the resulting If you think it is an improvement, it probably makes sense to have a bash package. It remains to be seen how difficult building it for Windows will be. |
It is only now that I understood the |
Well, I'm reticent to encourage you to do so. For my use case (embedded projects with extensive testing), I currently do not need any Python at all, thus a standalone meson makes some sense. For your use case probably having a plain Python around is a more realistic solution. Actually I do not understand the details of your build, thus a more conservative approach. As a side note, if for my projects I'll ever need Python, I'm considering a Python3 xPack, to be installed the same on all platforms. |
@ilg-ul, I have another use case for this: my static Python xPack now comes with root CA certificates - this was a problem mainly on macOS where it required that OpenSSL 1 was installed from homebrew. Now I don't need that the root certificates are installed on macOS and Linux - Windows is not a problem since it has its standard certificate store. The problem is that I need to set the However this has drawbacks and I wonder if there isn't a better way to do it. Patching Python is also an option, but this is not a trivial patch since Python will need to find the location of its own executable from within the C code of the |
I plan to update xpm, hopefully in 2-3 weeks, and include this feature too. I just need to complete development on the documentation sites. |
This adds support for setting environment variables when running actions
Unlike the commands, which are expanded in a single LiquidJS instance, the variables are expanded in separate instances. This is probably worth discussing.