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

Add shell.package_path setting for package.path defaults #1662

Open
wants to merge 6 commits into
base: mc-1.20.x
Choose a base branch
from

Conversation

MCJack123
Copy link
Contributor

This PR simply adds a new setting called shell.package_path, which stores the default package.path value. This allows users and programs to easily add global library paths without having to override cc.require. For instance, this can be used by package managers to add a central directory for shared libraries, instead of requiring programs to have their own copies of common software. The default settings will remain the same, and package.path changes in programs won't affect anything else globally.

@Wojbie
Copy link
Contributor

Wojbie commented Dec 31, 2023

Related discussion where this was already denied #739

@MCJack123
Copy link
Contributor Author

MCJack123 commented Dec 31, 2023

I'm thinking of this more from a user-oriented perspective, where the user gets to determine what their own path is (and hopefully a program/package manager would respect the user's wishes), rather than as something for programs to abuse for their own paths. Of course, you can't force programs to not do bad things, but the way things are right now makes it very difficult to have common libraries for your own programs, and I think this is the simplest and most minimally invasive way to fix it.


OTOH, maybe the reason CI failed is exactly why this is a bad idea. 🙃

If a global setting is a bad idea, then the next best way to resolve this issue is to add inheritance. This keeps the idea of using wrapper programs, but makes it a bit more flexible by allowing the original program to be run with shell.run as usual. It would resolve an annoying sticking point I had while developing Herobrine, where I needed to shell.run each program to get a new environment, but because package.path wasn't inherited, I had to add a line to append the library directory to every single program - this caught me when trying to run it uncompressed from a disk drive, as I had to change the path in every file.

@Lupus590
Copy link
Contributor

If a global setting is a bad idea, then the next best way to resolve this issue is to add inheritance. This keeps the idea of using wrapper programs, but makes it a bit more flexible by allowing the original program to be run with shell.run as usual. It would resolve an annoying sticking point I had while developing Herobrine, where I needed to shell.run each program to get a new environment, but because package.path wasn't inherited, I had to add a line to append the library directory to every single program - this caught me when trying to run it uncompressed from a disk drive, as I had to change the path in every file.

Would os.run be better here?

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

Successfully merging this pull request may close these issues.

None yet

3 participants