Skip to contentSkip to conversation

pylibfdt breakage

DISCUSSION David Gibson 3 participants 9 messages Oct 19, 2022 – Feb 4, 2023 4 messages not in the archive

lore
Share & tools
lore
#0 lore raw

Hi Simon,

I probably should have contacted you sooner about this. For some time, I've been unable to compile and test the pylibfdt components on my system (Fedora 36). I get this error:

$ make
	CHK version_gen.h
make[1]: Entering directory '/home/dwg/src/dtc'
	CHK version_gen.h
	 PYMOD pylibfdt/_libfdt.so
/usr/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
  warnings.warn(
/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/version.py:84: UserWarning: tag 'path-ref-fixup-staging' no version found
  warnings.warn(f"tag {tag!r} no version found")
Traceback (most recent call last):
  File "/home/dwg/src/dtc/./setup.py", line 50, in <module>
    setup(
  File "/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib64/python3.10/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 459, in __init__
    _Distribution.__init__(
  File "/usr/lib64/python3.10/distutils/dist.py", line 292, in __init__
    self.finalize_options()
  File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 837, in finalize_options
    ep(self)
  File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 858, in _finalize_setup_keywords
    ep.load()(self, ep.name, value)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/integration.py", line 90, in version_keyword
    _assign_version(dist, config)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/integration.py", line 59, in _assign_version
    maybe_version = _get_version(config)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/__init__.py", line 154, in _get_version
    parsed_version = _do_parse(config)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/__init__.py", line 101, in _do_parse
    version = _version_from_entrypoints(config) or _version_from_entrypoints(
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/_entrypoints.py", line 66, in _version_from_entrypoints
    version: ScmVersion | None = _call_entrypoint_fn(root, config, ep.load())
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/_entrypoints.py", line 40, in _call_entrypoint_fn
    return fn(root, config=config)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/git.py", line 181, in parse
    return _git_parse_inner(
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/git.py", line 224, in _git_parse_inner
    return meta(
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/version.py", line 226, in meta
    parsed_version = _parse_tag(tag, preformatted, config)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/version.py", line 203, in _parse_tag
    assert version is not None
AssertionError
make[1]: *** [pylibfdt/Makefile.pylibfdt:20: pylibfdt/_libfdt.so] Error 1
make[1]: Leaving directory '/home/dwg/src/dtc'
make: *** [Makefile:172: maybe_pylibfdt] Error 2

Seems like the packaging stuff needs work, but it's not obvious to me exactly what needs to be done. Is this something you can address?

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#1 lore raw

Hi David,

Quoted 56 lines · David Gibson

Hi Simon,

I probably should have contacted you sooner about this. For some time, I've been unable to compile and test the pylibfdt components on my system (Fedora 36). I get this error:

$ make
        CHK version_gen.h
make[1]: Entering directory '/home/dwg/src/dtc'
        CHK version_gen.h
         PYMOD pylibfdt/_libfdt.so
/usr/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
  warnings.warn(
/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/version.py:84: UserWarning: tag 'path-ref-fixup-staging' no version found
  warnings.warn(f"tag {tag!r} no version found")
Traceback (most recent call last):
  File "/home/dwg/src/dtc/./setup.py", line 50, in <module>
    setup(
  File "/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib64/python3.10/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 459, in __init__
    _Distribution.__init__(
  File "/usr/lib64/python3.10/distutils/dist.py", line 292, in __init__
    self.finalize_options()
  File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 837, in finalize_options
    ep(self)
  File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 858, in _finalize_setup_keywords
    ep.load()(self, ep.name, value)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/integration.py", line 90, in version_keyword
    _assign_version(dist, config)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/integration.py", line 59, in _assign_version
    maybe_version = _get_version(config)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/__init__.py", line 154, in _get_version
    parsed_version = _do_parse(config)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/__init__.py", line 101, in _do_parse
    version = _version_from_entrypoints(config) or _version_from_entrypoints(
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/_entrypoints.py", line 66, in _version_from_entrypoints
    version: ScmVersion | None = _call_entrypoint_fn(root, config, ep.load())
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/_entrypoints.py", line 40, in _call_entrypoint_fn
    return fn(root, config=config)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/git.py", line 181, in parse
    return _git_parse_inner(
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/git.py", line 224, in _git_parse_inner
    return meta(
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/version.py", line 226, in meta
    parsed_version = _parse_tag(tag, preformatted, config)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/version.py", line 203, in _parse_tag
    assert version is not None
AssertionError
make[1]: *** [pylibfdt/Makefile.pylibfdt:20: pylibfdt/_libfdt.so] Error 1
make[1]: Leaving directory '/home/dwg/src/dtc'
make: *** [Makefile:172: maybe_pylibfdt] Error 2
Quoted 2 lines

Seems like the packaging stuff needs work, but it's not obvious to me exactly what needs to be done. Is this something you can address?

I am not sure what is going on but perhaps we could drop setuptools_scm? I'm assuming it is for getting the version, but we have that in Makefile, so could perhaps parse it?

I actually have the same version of setuptools_scm here

python3-setuptools-scm (7.0.5-1)

but I cannot see the error. I found this:

https://github.com/pypa/setuptools_scm

For me:

sjg@sjg1:~/c/dtc$ pe
55778a0 (HEAD, us/master, us/main) libfdt: tests: add
get_next_tag_invalid_prop_len
7359034 libfdt: prevent integer overflow in fdt_next_tag
035fb90 libfdt: add fdt_get_property_by_offset_w helper
98a0700 Makefile: fix infinite recursion by dropping non-existent `%.output`
$ python setup.py --version
1.6.2.dev63+g55778a0

Regards,
Simon

A message that is not in the archive (sent off-list or not yet received): CAPnjgZ1SfQaBSmn-P6aGTNh0B1R2R4CbRXsRS9H4sF3VW4D=kQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#3 lore raw
Quoted 59 lines · Simon Glass

Hi David,

Quoted 56 lines · David Gibson

Hi Simon,

I probably should have contacted you sooner about this. For some time, I've been unable to compile and test the pylibfdt components on my system (Fedora 36). I get this error:

$ make
        CHK version_gen.h
make[1]: Entering directory '/home/dwg/src/dtc'
        CHK version_gen.h
         PYMOD pylibfdt/_libfdt.so
/usr/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
  warnings.warn(
/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/version.py:84: UserWarning: tag 'path-ref-fixup-staging' no version found
  warnings.warn(f"tag {tag!r} no version found")
Traceback (most recent call last):
  File "/home/dwg/src/dtc/./setup.py", line 50, in <module>
    setup(
  File "/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib64/python3.10/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 459, in __init__
    _Distribution.__init__(
  File "/usr/lib64/python3.10/distutils/dist.py", line 292, in __init__
    self.finalize_options()
  File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 837, in finalize_options
    ep(self)
  File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 858, in _finalize_setup_keywords
    ep.load()(self, ep.name, value)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/integration.py", line 90, in version_keyword
    _assign_version(dist, config)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/integration.py", line 59, in _assign_version
    maybe_version = _get_version(config)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/__init__.py", line 154, in _get_version
    parsed_version = _do_parse(config)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/__init__.py", line 101, in _do_parse
    version = _version_from_entrypoints(config) or _version_from_entrypoints(
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/_entrypoints.py", line 66, in _version_from_entrypoints
    version: ScmVersion | None = _call_entrypoint_fn(root, config, ep.load())
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/_entrypoints.py", line 40, in _call_entrypoint_fn
    return fn(root, config=config)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/git.py", line 181, in parse
    return _git_parse_inner(
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/git.py", line 224, in _git_parse_inner
    return meta(
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/version.py", line 226, in meta
    parsed_version = _parse_tag(tag, preformatted, config)
  File "/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/version.py", line 203, in _parse_tag
    assert version is not None
AssertionError
make[1]: *** [pylibfdt/Makefile.pylibfdt:20: pylibfdt/_libfdt.so] Error 1
make[1]: Leaving directory '/home/dwg/src/dtc'
make: *** [Makefile:172: maybe_pylibfdt] Error 2
Quoted 6 lines
Quoted 2 lines

Seems like the packaging stuff needs work, but it's not obvious to me exactly what needs to be done. Is this something you can address?

I am not sure what is going on but perhaps we could drop setuptools_scm? I'm assuming it is for getting the version, but we have that in Makefile, so could perhaps parse it?

Well, you tell me. I really don't know how setuptools work, nor do I have the time to figure it out.

Or whatever has replaced setuptools that we're supposed to be using instead according to that DeprecationWarning.

Quoted 17 lines

I actually have the same version of setuptools_scm here

python3-setuptools-scm (7.0.5-1)

but I cannot see the error. I found this:

https://github.com/pypa/setuptools_scm

For me:

sjg@sjg1:~/c/dtc$ pe
55778a0 (HEAD, us/master, us/main) libfdt: tests: add
get_next_tag_invalid_prop_len
7359034 libfdt: prevent integer overflow in fdt_next_tag
035fb90 libfdt: add fdt_get_property_by_offset_w helper
98a0700 Makefile: fix infinite recursion by dropping non-existent `%.output`
Quoted 2 lines
$ python setup.py --version
1.6.2.dev63+g55778a0

Hrm. I get an error similar to the one above just attempting to get the --version like this.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#4 lore raw
In reply to David Gibson
Quoted 7 lines · David Gibson

Hi Simon,

I probably should have contacted you sooner about this. For some time, I've been unable to compile and test the pylibfdt components on my system (Fedora 36). I get this error:

Quoted 8 lines
$ make
        CHK version_gen.h
make[1]: Entering directory '/home/dwg/src/dtc'
        CHK version_gen.h
         PYMOD pylibfdt/_libfdt.so
/usr/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
  warnings.warn(
/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/version.py:84: UserWarning: tag 'path-ref-fixup-staging' no version found

I think the problem is you have a git tag 'path-ref-fixup-staging' which doesn't match any version pattern (e.g. v1.0.0). The default pattern is:

DEFAULT_TAG_REGEX = r"^(?:[\w-]+-)?(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$"

https://github.com/pypa/setuptools_scm/blob/main/src/setuptools_scm/config.py#L28

Rob

A message that is not in the archive (sent off-list or not yet received): CAL_Jsq+Lmkw51EAtBb62ET4xzChmTf6MGVq=pBjRoYY6Z+vQ6g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw
Quoted 19 lines · Rob Herring
Quoted 7 lines · David Gibson

Hi Simon,

I probably should have contacted you sooner about this. For some time, I've been unable to compile and test the pylibfdt components on my system (Fedora 36). I get this error:

Quoted 8 lines
$ make
        CHK version_gen.h
make[1]: Entering directory '/home/dwg/src/dtc'
        CHK version_gen.h
         PYMOD pylibfdt/_libfdt.so
/usr/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
  warnings.warn(
/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/version.py:84: UserWarning: tag 'path-ref-fixup-staging' no version found
Quoted 8 lines

I think the problem is you have a git tag 'path-ref-fixup-staging' which doesn't match any version pattern (e.g. v1.0.0). The default pattern is:

DEFAULT_TAG_REGEX = r"^(?:[\w-]+-)?(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$"

https://github.com/pypa/setuptools_scm/blob/main/src/setuptools_scm/config.py#L28

I tried adding non-version tags and still don't reproduce this.

What does this give you: python setup.py --version

Can you run the build with "SETUPTOOLS_SCM_DEBUG=1".

Rob

A message that is not in the archive (sent off-list or not yet received): CAL_Jsq+5ZrjQ5zVjjdmprW1+8nyTewXMb+0R+iyPG3J4xjkKPA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#8 lore raw
Quoted 20 lines · Rob Herring
Quoted 19 lines · Rob Herring
Quoted 15 lines · David Gibson

Hi Simon,

I probably should have contacted you sooner about this. For some time, I've been unable to compile and test the pylibfdt components on my system (Fedora 36). I get this error:

$ make
        CHK version_gen.h
make[1]: Entering directory '/home/dwg/src/dtc'
        CHK version_gen.h
         PYMOD pylibfdt/_libfdt.so
/usr/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
  warnings.warn(
/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/version.py:84: UserWarning: tag 'path-ref-fixup-staging' no version found
Quoted 3 lines
Quoted 3 lines

I think the problem is you have a git tag 'path-ref-fixup-staging' which doesn't match any version pattern (e.g. v1.0.0). The default pattern is:

Hrm. I don't have a tag called 'path-ref-fixup-staging'. I do have one called 'path-ref-fixup-v1' (generated by git publish). I'm not sure why setuptools would be looking at tags unrelated to my current branch anyway.

Quoted 8 lines
Quoted 4 lines

DEFAULT_TAG_REGEX = r"^(?:[\w-]+-)?(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$"

https://github.com/pypa/setuptools_scm/blob/main/src/setuptools_scm/config.py#L28

I tried adding non-version tags and still don't reproduce this.

What does this give you: python setup.py --version

So... that alone is enough to crash..

$ python setup.py --version
/usr/lib/python3.11/site-packages/setuptools_scm/version.py:84: UserWarning: tag 'path-ref-fixup-staging' no version found
  warnings.warn(f"tag {tag!r} no version found")
Traceback (most recent call last):
  File "/home/dwg/src/dtc/setup.py", line 50, in <module>
    setup(
  File "/usr/lib/python3.11/site-packages/setuptools/__init__.py", line 87, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 139, in setup
    _setup_distribution = dist = klass(attrs)
                                 ^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/dist.py", line 477, in __init__
    _Distribution.__init__(
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 275, in __init__
    self.finalize_options()
  File "/usr/lib/python3.11/site-packages/setuptools/dist.py", line 901, in finalize_options
    ep(self)
  File "/usr/lib/python3.11/site-packages/setuptools/dist.py", line 922, in _finalize_setup_keywords
    ep.load()(self, ep.name, value)
  File "/usr/lib/python3.11/site-packages/setuptools_scm/integration.py", line 90, in version_keyword
    _assign_version(dist, config)
  File "/usr/lib/python3.11/site-packages/setuptools_scm/integration.py", line 59, in _assign_version
    maybe_version = _get_version(config)
                    ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools_scm/__init__.py", line 154, in _get_version
    parsed_version = _do_parse(config)
                     ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools_scm/__init__.py", line 101, in _do_parse
    version = _version_from_entrypoints(config) or _version_from_entrypoints(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools_scm/_entrypoints.py", line 66, in _version_from_entrypoints
    version: ScmVersion | None = _call_entrypoint_fn(root, config, ep.load())
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools_scm/_entrypoints.py", line 40, in _call_entrypoint_fn
    return fn(root, config=config)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools_scm/git.py", line 181, in parse
    return _git_parse_inner(
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools_scm/git.py", line 224, in _git_parse_inner
    return meta(
           ^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools_scm/version.py", line 226, in meta
    parsed_version = _parse_tag(tag, preformatted, config)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools_scm/version.py", line 203, in _parse_tag
    assert version is not None
AssertionError
Quoted 1 line

Can you run the build with "SETUPTOOLS_SCM_DEBUG=1".

$ SETUPTOOLS_SCM_DEBUG=1 python setup.py --version
version keyword {'name': 'libfdt', 'version': None, 'author': 'Simon Glass', 'author_email': '[email protected]', 'maintainer': None, 'maintainer_email': None, 'url': 'https://git.kernel.org/pub/scm/utils/dtc/dtc.git', 'license': 'BSD', 'description': 'Python binding for libfdt', 'long_description': '# Device Tree Compiler and libfdt\n\nThe source tree contains the Device Tree Compiler (dtc) toolchain for\nworking with device tree source and binary files and also libfdt, a\nutility library for reading and manipulating the binary format.\n\ndtc and libfdt are maintained by:\n\n* [David Gibson `<[email protected]>`](mailto:[email protected])\n\n## Python library\n\nA Python library wrapping libfdt is also available. To build this you\nwill need to install `swig` and Python development files. On Debian\ndistributions:\n\n```\n$ sudo apt-get install swig python3-dev\n```\n\nThe library provides an `Fdt` class which you can use like this:\n\n```\n$ PYTHONPATH=../pylibfdt python3\n>>> import libfdt\n>>> fdt = libfdt.Fdt(open(\'test_tree1.dtb\', mode=\'rb\').read())\n>>> node = fdt.path_offset(\'/subnode@1\')\n>>> print(node)\n124\n>>> prop_offset = fdt.first_property_offset(node)\n>>> prop = fdt.get_property_by_offset(prop_offset)\n>>> print(\'%s=%s\' % (prop.name, prop.as_str()))\ncompatible=subnode1\n>>> node2 = fdt.path_offset(\'/\')\n>>> print(fdt.getprop(node2, \'compatible\').as_str())\ntest_tree1\n```\n\nYou will find tests in `tests/pylibfdt_tests.py` showing how to use each\nmethod. Help is available using the Python help command, e.g.:\n\n```\n$ cd pylibfdt\n$ python3 -c "import libfdt; help(libfdt)"\n```\n\nIf you add new features, please check code coverage:\n\n```\n$ sudo apt-get install python3-coverage\n$ cd tests\n# It\'s just \'coverage\' on most other distributions\n$ python3-coverage run pylibfdt_tests.py\n$ python3-coverage html\n# Open \'htmlcov/index.html\' in your browser\n```\n\nThe library can be installed with pip from a local source tree:\n\n```\n$ pip install . [--user|--prefix=/path/to/install_dir]\n```\n\nOr directly from a remote git repo:\n\n```\n$ pip install git+git://git.kernel.org/pub/scm/utils/dtc/dtc.git@main\n```\n\nThe install depends on libfdt shared library being installed on the\nhost system first. Generally, using `--user` or `--prefix` is not\nnecessary and pip will use the default location for the Python\ninstallation which varies if the user is root or not.\n\nYou can also install everything via make if you like, but pip is\nrecommended.\n\nTo install both libfdt and pylibfdt you can use:\n\n```\n$ make install [PREFIX=/path/to/install_dir]\n```\n\nTo disable building the python library, even if swig and Python are available,\nuse:\n\n```\n$ make NO_PYTHON=1\n```\n\nMore work remains to support all of libfdt, including access to numeric\nvalues.\n\n## Mailing lists\n\n* The [devicetree-compiler](mailto:[email protected])\n  list is for discussion about dtc and libfdt implementation.\n* Core device tree bindings are discussed on the\n  [devicetree-spec](mailto:[email protected]) list.\n\n', 'keywords': None, 'platforms': None, 'classifiers': ['Programming Language :: Python :: 3', 'License :: OSI Approved :: BSD License', 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)', 'Operating System :: OS Independent'], 'download_url': None, 'provides': None, 'requires': None, 'obsoletes': None}
abs root {'root': '/home/dwg/src/dtc', 'relative_to': None}
root '/home/dwg/src/dtc'
relative_to None
dist name: libfdt
version_from_ep setuptools_scm.parse_scm /home/dwg/src/dtc
looking for ep setuptools_scm.parse_scm /home/dwg/src/dtc
found ep EntryPoint(name='.git', value='setuptools_scm.git:parse', group='setuptools_scm.parse_scm') in /home/dwg/src/dtc
----
cmd:
     git --git-dir /home/dwg/src/dtc/.git rev-parse --show-prefix
 in: /home/dwg/src/dtc
out:

real root /home/dwg/src/dtc
----
cmd:

     git --git-dir /home/dwg/src/dtc/.git describe --dirty --tags --long --match "*[0-9]*"
 in: /home/dwg/src/dtc
out:
     path-ref-fixup-staging-10-g2022bb1

err:
warning: tag 'path-ref-fixup-v1' is externally known as 'path-ref-fixup-staging'

----
cmd:

     git --git-dir /home/dwg/src/dtc/.git rev-parse --abbrev-ref HEAD

in: /home/dwg/src/dtc
out:
main

----
cmd:

     git --git-dir /home/dwg/src/dtc/.git -c log.showSignature=false log -n 1 HEAD --format=%cI
 in: /home/dwg/src/dtc
out:
     2023-02-02T17:46:54+11:00

tag path-ref-fixup-staging
tag 'path-ref-fixup-staging' parsed to None /usr/lib/python3.11/site-packages/setuptools_scm/version.py:84: UserWarning: tag 'path-ref-fixup-staging' no version found
warnings.warn(f"tag {tag!r} no version found")
Traceback (most recent call last):
File "/home/dwg/src/dtc/setup.py", line 50, in <module>

    setup(
  File "/usr/lib/python3.11/site-packages/setuptools/__init__.py", line 87, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 139, in setup
    _setup_distribution = dist = klass(attrs)
                                 ^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/dist.py", line 477, in __init__
    _Distribution.__init__(
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 275, in __init__
    self.finalize_options()
  File "/usr/lib/python3.11/site-packages/setuptools/dist.py", line 901, in finalize_options
    ep(self)
  File "/usr/lib/python3.11/site-packages/setuptools/dist.py", line 922, in _finalize_setup_keywords
    ep.load()(self, ep.name, value)
  File "/usr/lib/python3.11/site-packages/setuptools_scm/integration.py", line 90, in version_keyword
    _assign_version(dist, config)
  File "/usr/lib/python3.11/site-packages/setuptools_scm/integration.py", line 59, in _assign_version
    maybe_version = _get_version(config)
                    ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools_scm/__init__.py", line 154, in _get_version
    parsed_version = _do_parse(config)
                     ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools_scm/__init__.py", line 101, in _do_parse
    version = _version_from_entrypoints(config) or _version_from_entrypoints(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools_scm/_entrypoints.py", line 66, in _version_from_entrypoints
    version: ScmVersion | None = _call_entrypoint_fn(root, config, ep.load())
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools_scm/_entrypoints.py", line 40, in _call_entrypoint_fn
    return fn(root, config=config)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools_scm/git.py", line 181, in parse
    return _git_parse_inner(
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools_scm/git.py", line 224, in _git_parse_inner
    return meta(
           ^^^^^

File "/usr/lib/python3.11/site-packages/setuptools_scm/version.py", line 226, in meta
parsed_version = _parse_tag(tag, preformatted, config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/setuptools_scm/version.py", line 203, in _parse_tag
assert version is not None
AssertionError

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#9 lore raw
Quoted 33 lines · David Gibson
Quoted 20 lines · Rob Herring
Quoted 19 lines · Rob Herring
Quoted 15 lines · David Gibson

Hi Simon,

I probably should have contacted you sooner about this. For some time, I've been unable to compile and test the pylibfdt components on my system (Fedora 36). I get this error:

$ make
        CHK version_gen.h
make[1]: Entering directory '/home/dwg/src/dtc'
        CHK version_gen.h
         PYMOD pylibfdt/_libfdt.so
/usr/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
  warnings.warn(
/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/version.py:84: UserWarning: tag 'path-ref-fixup-staging' no version found
Quoted 3 lines
Quoted 3 lines

I think the problem is you have a git tag 'path-ref-fixup-staging' which doesn't match any version pattern (e.g. v1.0.0). The default pattern is:

Hrm. I don't have a tag called 'path-ref-fixup-staging'. I do have one called 'path-ref-fixup-v1' (generated by git publish). I'm not sure why setuptools would be looking at tags unrelated to my current branch anyway.

Quoted 3 lines
Quoted 3 lines

DEFAULT_TAG_REGEX = r"^(?:[\w-]+-)?(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$"

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

https://github.com/pypa/setuptools_scm/blob/main/src/setuptools_scm/config.py#L28

I tried adding non-version tags and still don't reproduce this.

What does this give you: python setup.py --version

So... that alone is enough to crash..

[snip]

So, I tried re-cloning from the upstream repo, and now it works. So *something* was bogus in my git state, though I'm not at all sure what.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#10 lore raw
In reply to David Gibson
Quoted 38 lines · David Gibson
Quoted 20 lines · Rob Herring
Quoted 19 lines · Rob Herring
Quoted 15 lines · David Gibson

Hi Simon,

I probably should have contacted you sooner about this. For some time, I've been unable to compile and test the pylibfdt components on my system (Fedora 36). I get this error:

$ make
        CHK version_gen.h
make[1]: Entering directory '/home/dwg/src/dtc'
        CHK version_gen.h
         PYMOD pylibfdt/_libfdt.so
/usr/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
  warnings.warn(
/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/version.py:84: UserWarning: tag 'path-ref-fixup-staging' no version found
Quoted 3 lines
Quoted 3 lines

I think the problem is you have a git tag 'path-ref-fixup-staging' which doesn't match any version pattern (e.g. v1.0.0). The default pattern is:

Hrm. I don't have a tag called 'path-ref-fixup-staging'. I do have one called 'path-ref-fixup-v1' (generated by git publish). I'm not sure why setuptools would be looking at tags unrelated to my current branch anyway.

Quoted 7 lines
Quoted 4 lines

DEFAULT_TAG_REGEX = r"^(?:[\w-]+-)?(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$"

https://github.com/pypa/setuptools_scm/blob/main/src/setuptools_scm/config.py#L28

I tried adding non-version tags and still don't reproduce this.

[...]

Quoted 6 lines

----
cmd:

     git --git-dir /home/dwg/src/dtc/.git describe --dirty --tags --long --match "*[0-9]*"
 in: /home/dwg/src/dtc
out:
     path-ref-fixup-staging-10-g2022bb1

Here's where things start going sideways. I'd go look at .git/refs/tags/ next.

Rob

A message that is not in the archive (sent off-list or not yet received): CAL_JsqLF-FGrMPb523MVbaJ=MkczNOaJTGg5zzpZfb3oEsv6+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#12 lore raw
Quoted 42 lines · Rob Herring
Quoted 38 lines · David Gibson
Quoted 20 lines · Rob Herring
Quoted 19 lines · Rob Herring
Quoted 15 lines · David Gibson

Hi Simon,

I probably should have contacted you sooner about this. For some time, I've been unable to compile and test the pylibfdt components on my system (Fedora 36). I get this error:

$ make
        CHK version_gen.h
make[1]: Entering directory '/home/dwg/src/dtc'
        CHK version_gen.h
         PYMOD pylibfdt/_libfdt.so
/usr/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
  warnings.warn(
/home/dwg/src/dtc/.eggs/setuptools_scm-7.0.5-py3.10.egg/setuptools_scm/version.py:84: UserWarning: tag 'path-ref-fixup-staging' no version found
Quoted 3 lines
Quoted 3 lines

I think the problem is you have a git tag 'path-ref-fixup-staging' which doesn't match any version pattern (e.g. v1.0.0). The default pattern is:

Hrm. I don't have a tag called 'path-ref-fixup-staging'. I do have one called 'path-ref-fixup-v1' (generated by git publish). I'm not sure why setuptools would be looking at tags unrelated to my current branch anyway.

Quoted 7 lines
Quoted 4 lines

DEFAULT_TAG_REGEX = r"^(?:[\w-]+-)?(?P<version>[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$"

https://github.com/pypa/setuptools_scm/blob/main/src/setuptools_scm/config.py#L28

I tried adding non-version tags and still don't reproduce this.

[...]

Quoted 8 lines
Quoted 6 lines

----
cmd:

     git --git-dir /home/dwg/src/dtc/.git describe --dirty --tags --long --match "*[0-9]*"
 in: /home/dwg/src/dtc
out:
     path-ref-fixup-staging-10-g2022bb1

Here's where things start going sideways. I'd go look at .git/refs/tags/ next.

Yeah, that turns out to be unenlightening:

$ ls .git/refs/tags/ -la
total 0
drwxrwxr-x. 1 dwg dwg  0 Sep 26 15:23 ./
drwxrwxr-x. 1 dwg dwg 32 Nov 21 14:03 ../
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson