Skip to content

Conversation

gguo11837463
Copy link
Contributor

We don't want to download swig manually.
Hope pip install can finish it directly.

@gguo11837463 gguo11837463 force-pushed the gua_pylibfdt_depend_swig branch from 867ba8a to bf8b1af Compare August 9, 2024 06:45
Copy link

@sjg20 sjg20 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to land in dtc upstream:

https://github.com/dgibson/dtc

But setup.py is a bit out-of-sync in the two projects, so I will see if I can tidy that up.

setup.py Outdated
cmdclass = {'build_py' : build_py},
use_scm_version=True,
setup_requires = ['setuptools_scm'],
setup_requires = ['setuptools', 'swig'],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need the change to setuptools ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AIUI, 'swig' here is just a wrapper package to download and install swig which is not a python package. What happens if the distro version of swig is already installed?

Copy link
Contributor Author

@gguo11837463 gguo11837463 Aug 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use python 3.12 to verify it on Windows, setuptools is necessary.

Without this PR and don't install swig manually

With this PR and don't install swig manually.

@robherring
Copy link
Member

This needs to land in dtc upstream:

https://github.com/dgibson/dtc

But setup.py is a bit out-of-sync in the two projects, so I will see if I can tidy that up.

Good luck with that. I gave up. The issue is that python has its own ideas about how to build things and that's at odds with make and meson (more meson). IMO, we shouldn't try to wrap the python build with make and meson, but let users interact with python build directly that anyone familiar with python packages understands (i.e. running ./setup.py or pip). And it's not just running the build/install, but all the other python tools which integrate in such as pytest. Or at a minimum, finish the meson conversion first, so there's not 2 environments you are trying to shoehorn setup.py into. Also, I'm sure you are aware, but setup.py has been superseded by setup.cfg^Wpyproject.toml. Might want to consider moving to that before wrestling with make/meson integration. I'm sure pyproject.toml has its own quirks to deal with.

The other issue was also what is the source of libfdt. Is it the one you build (and install?) or the distro installed one. IIRC, that was at odds with what I wanted to do here.

@gguo11837463 gguo11837463 force-pushed the gua_pylibfdt_depend_swig branch 2 times, most recently from 7cbe824 to e5f1dad Compare August 10, 2024 01:50
@gguo11837463
Copy link
Contributor Author

This needs to land in dtc upstream:
https://github.com/dgibson/dtc
But setup.py is a bit out-of-sync in the two projects, so I will see if I can tidy that up.

Good luck with that. I gave up. The issue is that python has its own ideas about how to build things and that's at odds with make and meson (more meson). IMO, we shouldn't try to wrap the python build with make and meson, but let users interact with python build directly that anyone familiar with python packages understands (i.e. running ./setup.py or pip). And it's not just running the build/install, but all the other python tools which integrate in such as pytest. Or at a minimum, finish the meson conversion first, so there's not 2 environments you are trying to shoehorn setup.py into. Also, I'm sure you are aware, but setup.py has been superseded by setup.cfg^Wpyproject.toml. Might want to consider moving to that before wrestling with make/meson integration. I'm sure pyproject.toml has its own quirks to deal with.

The other issue was also what is the source of libfdt. Is it the one you build (and install?) or the distro installed one. IIRC, that was at odds with what I wanted to do here.

I just use it https://pypi.org/project/pylibfdt/ by pip install pylibfdt, but if I don't install by chocolatey install swig or https://sourceforge.net/p/swig/news/2024/02/swig-421-released/ on windows, pip install always failure, so want to make it done by this way.

We don't want to download swig manually.
Hope pip install can finish it directly.

Signed-off-by: Gua Guo <gua.guo@intel.com>
@gguo11837463 gguo11837463 force-pushed the gua_pylibfdt_depend_swig branch from e5f1dad to 8121f99 Compare August 10, 2024 13:12
@sjg20
Copy link

sjg20 commented Aug 11, 2024

I sent some patches upstream too

https://www.spinics.net/lists/devicetree-compiler/

sjg20 pushed a commit to sjg20/dtc-old that referenced this pull request Aug 13, 2024
Windows apparently builds pylibfdt if swig is declared as a dependency
in the setup file. Otherwise it must be installed manually and Windows
does not sport a package manager, so this is hard for users.

This change seems to have no ill effects on Linux, at least.

So add a new setup_requires line.

Commit-notes:
This was picked up from:

devicetree-org/pylibfdt#2
END

Series-to: dtc
Series-cc: Gua Guo <gua.guo@intel.com>, david

Signed-off-by: Gua Guo <gua.guo@intel.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
@robherring robherring merged commit b980a27 into devicetree-org:main Aug 15, 2024
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.

3 participants