Replies: 3 comments 1 reply
-
The issue got closed before I had a change to suggest what you've done: move to a discussion. Despite your suggestion there's nothing to talk about, I think there's quite a lot. Without going into the merits of a big change to SCons: build systems generally have some kind of language for describing the details of a build, filling in the details it can't deduce itself, and then you call the tool, and it does the work. SCons happens to use Python - mostly; there's also a language for describing token replacement, which is very heavily used in key places, so it's not just all Python. Not really aware of any build systems, beyond those that store the instructions in a "shell script" with minimal smarts, that think the description of the build is something that's considered a standalone program you could just run directly. Obviously, I know about only a small fraction of all the things the world has invented to solve build problems, but... what's the actual need here? |
Beta Was this translation helpful? Give feedback.
-
Make Scons readable, intuitive and compliant with tools and docs/design assumptions .
But
I understand, but it is a different statement than in the user guide. I see that already: But the shebang states something else:
I haven't seen it yet. I believe there could be a solution that doesn't involve hacking Python. However depending on what is currently being replaced, the compatibility may be broken.
At the top level:
The rest is tech details. Yes, maybe a lot, but it will not change the goal.
Choosing Python gives flexibility, which is why Scons is often preferred over other tools. Let's make Scons fully Python-comptaible. |
Beta Was this translation helpful? Give feedback.
-
Another example why this just can't work:
gives
but
because of # Adding global functions to the SConscript name space. magic You can expose |
Beta Was this translation helpful? Give feedback.
-
Here is a copy of closed issue, which still exists in Scons: #4661
The issue comes from old, ugly and hacky codebase. Needs some deep refactoring, but with preserving a high level API / SConstruct syntax.
Is it doable in one ticket and PR? I think so.
Will this break compatibility? Yes.But it is worth it (SCons2)
In fact there is nothing to talk about. It should be just done.
Nothing from scons is imported in SConstruct file. This makes SConstruct an invalid python script. In fact this is not a python script. Linters does not work. Also nobody knows which object / class comes from.
Also there is sys.path mangling and globals magic, which makes this package incompatible with all python tools (not mentioning good practices in python programming).
The point is to do it right. Refactoring can be difficult, but it's worth it if Scons is going to be a future-proof tool. The whole thing is about making SConstruct a real python script, as stated in the docs. This will allow using all python tools, not only rare IDEs (#3210, which is not a solution - think about linters, other IDEs).
Assumption: Adding explicite imports should remove globals magic, and importlib should solve importing other SConstruct files as modules (see import_from_path https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly). Both changes will make Scons user- and stack friendly.
There is no other way to make SConstruct a python script.
This is not about IDE plugins. You are preventing from using all tools, incl. linters.
Have you tried this? I tried. It does not work because of false negatives. This is not a solution. Even if I add imports, Scons is still changing sys.paths and not using importlib capabilities. This will never work, because there are ugly, old hacks under the hood, which causes a lot of troubles.
I am aware of that. They must just die (read: be upgraded) in few years. That's why I said about the future. There is no other way. And we are talking just about imports, not changing the syntax.
Beta Was this translation helpful? Give feedback.
All reactions