Move odict and oset code to build/inline_copy/
See original GitHub issueCurrently there are quite a few unconditional uses of nuitka.containers.odict
.
Builtins.py:from nuitka.containers.odict import OrderedDict
build/inline_copy/lib/scons-2.3.2/SCons/Executor.py: for odict in self.overridelist:
build/inline_copy/lib/scons-2.3.2/SCons/Executor.py: overrides.update(odict)
build/inline_copy/lib/scons-3.1.2/SCons/Executor.py: for odict in self.overridelist:
build/inline_copy/lib/scons-3.1.2/SCons/Executor.py: overrides.update(odict)
codegen/Reports.py:from nuitka.containers.odict import OrderedDict
containers/odict.py:It is not in 2.6, for this version we are using the odict.py as mentioned in the
freezer/Standalone.py:from nuitka.containers.odict import OrderedDict
nodes/LocalsScopes.py:from nuitka.containers.odict import OrderedDict
plugins/Plugins.py:from nuitka.containers.odict import OrderedDict
oset.py is similar.
On Python 2.7+, the code in nuitka.containers.odict
is ignored, except for imports from stdlib/builtins.
As this module is under the “Python-2.0” SPDX license, and rightly has no Apache-2.0 header, it is desirable to not include it in distro packages unless necessary. Its inclusion means the Nuitka package should use “License: Apache-2.0 AND Python-2.0” which is likely unnecessarily complications and confusion to wary users.
It can still be in the source tree, ideally under build/inline_copy
, so it is easier to remove it.
The oset code should also be moved into build/inline_copy/ . It might be possible to inline https://pypi.org/project/oset/ , thereby making it easier to patch in the python package if present. That packages repo has disappeared - need to check its other metadata to see if it appropriately credits the original authors. (its setup.py uses maintainer=...
but not author=..
. http://code.activestate.com/recipes/576694/ is MIT. Now we need “License: Apache-2.0 AND Python-2.0 AND MIT”. Ugh.
And I notice inside oset.py
# Note: Kay Hayen did some changes for Nuitka keeping this license. These
# changes are not improvements, use the original source instead, not this
# file.
Another alternative is to use one of the many other better-maintained ordered set libraries.
I’m about to do a build with the following so that I dont need to change the License:...
echo 'from collections import OrderedDict' > nuitka/containers/odict.py
echo 'from ordered_set import OrderedSet' > nuitka/containers/oset.py
I expect this to break … 😉
A code search reveals to other licenses in use
build/include/nuitka/hedley.h: * SPDX-License-Identifier: CC0-1.0
build/include/nuitka/incbin.h:For more information, please refer to <http://unlicense.org/>
Those files also have the Apache-2.0 header, so are being dual-licensed as Apache-2.0, and that is legally sound and appropriate to do in this case, and means these two files are not problematic.
Are there any other bits of inlined code in the codebase?
Issue Analytics
- State:
- Created 3 years ago
- Comments:17 (17 by maintainers)
Top GitHub Comments
The first one, does the wrong trade of, citing their desc:
Since I am doing deletions, I highly disapprove of that.
The second one is using Cython, which I approve of and is Python2 compatible as well, which is something I need. I would welcome a PR that makes optional use of it. It might make some things in Nuitka compile time faster.
https://pypi.org/project/ordered-set/ and https://pypi.org/project/orderedset/ passed all of the test suite. I guess that is sufficient to use it. If you are aware of the parts of Nuitka using oset which dont have test coverage, I should manually test them.
boltons works:
extended-collections
works:sortedcollections
isnt usable due to https://github.com/grantjenks/python-sortedcollections/issues/17 , andoset
has the same problem.ordered-hash-set
fails with:nr.collections
fails withAttributeError: 'OrderedSet' object has no attribute 'index'