diff mbox series

Support packaging

Message ID gu3erz2kuwv6e4nijjwavi2pci2ohlfcoaornwyicfsufgii7p@wsazr62z42tf
State New
Headers show
Series Support packaging | expand

Commit Message

Wu Zhenyu June 16, 2023, 6:44 a.m. UTC
use `python -m build` to package
---
 .gitignore               | 130 ++++++++++++++++++++++++++++++++++++++-
 lib/bb/server/process.py |   5 +-
 pyproject.toml           | 109 ++++++++++++++++++++++++++++++++
 3 files changed, 240 insertions(+), 4 deletions(-)
 create mode 100644 pyproject.toml

Comments

Richard Purdie June 16, 2023, 7:37 a.m. UTC | #1
On Fri, 2023-06-16 at 14:44 +0800, Wu Zhenyu wrote:
> use `python -m build` to package
> ---
>  .gitignore               | 130 ++++++++++++++++++++++++++++++++++++++-
>  lib/bb/server/process.py |   5 +-
>  pyproject.toml           | 109 ++++++++++++++++++++++++++++++++
>  3 files changed, 240 insertions(+), 4 deletions(-)
>  create mode 100644 pyproject.toml

I believe we said no to this in bugzilla recently.

The issue is that bitbake's version is tied to the release you're
building. If you start including this on pypi or with packaging it with
distros themselves, people will complain that the version doesn't match
the one needed for the release they're currently building. Changing
that requires API commitments we've not been able to make.

Yes, multiple versions on pypi and selecting the one you want in a
python venv would be nice and one way to avoid that but once in pypi,
the support issues arising from people using it in a way we've not
intended would likely outweigh that.

By not having a pyproject.toml file, we make it clear that we don't
support using bitbake in that way.

Cheers,

Richard
Wu Zhenyu June 23, 2023, 9:13 a.m. UTC | #2
Hi, I create a language server for bitbake in <https://github.com/Freed-Wu/bitbake-language-server>.
It really need bitbake as a python package to provide the full functions.
Now I have to use <https://aur.archlinux.org/packages/python-bitbake> as a dependency.
Can you rethink again about packaging it in PYPI?

On Fri, Jun 16, 2023 at 08:37:49AM +0100, Richard Purdie wrote:
> On Fri, 2023-06-16 at 14:44 +0800, Wu Zhenyu wrote:
> > use `python -m build` to package
> > ---
> >  .gitignore               | 130 ++++++++++++++++++++++++++++++++++++++-
> >  lib/bb/server/process.py |   5 +-
> >  pyproject.toml           | 109 ++++++++++++++++++++++++++++++++
> >  3 files changed, 240 insertions(+), 4 deletions(-)
> >  create mode 100644 pyproject.toml
> 
> I believe we said no to this in bugzilla recently.
> 
> The issue is that bitbake's version is tied to the release you're
> building. If you start including this on pypi or with packaging it with
> distros themselves, people will complain that the version doesn't match
> the one needed for the release they're currently building. Changing
> that requires API commitments we've not been able to make.
> 
> Yes, multiple versions on pypi and selecting the one you want in a
> python venv would be nice and one way to avoid that but once in pypi,
> the support issues arising from people using it in a way we've not
> intended would likely outweigh that.
> 
> By not having a pyproject.toml file, we make it clear that we don't
> support using bitbake in that way.
> 
> Cheers,
> 
> Richard
> 
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#14837): https://lists.openembedded.org/g/bitbake-devel/message/14837
> Mute This Topic: https://lists.openembedded.org/mt/99565559/7696550
> Group Owner: bitbake-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/leave/12382373/7696550/1830237952/xyzzy [wuzhenyu@ustc.edu]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Richard Purdie June 23, 2023, 9:21 a.m. UTC | #3
On Fri, 2023-06-23 at 17:13 +0800, Wu Zhenyu wrote:
> Hi, I create a language server for bitbake in <https://github.com/Freed-Wu/bitbake-language-server>.
> It really need bitbake as a python package to provide the full functions.
> Now I have to use <https://aur.archlinux.org/packages/python-bitbake> as a dependency.
> Can you rethink again about packaging it in PYPI?

A language server sounds really interesting and I'll have to take a
look. If we add it to PYPI, who is going to deal with the usability
issues I mentioned, the documentation problem and the resulting support
where people mismatch bitbake versions?

There are some specific issues we'd need to solve if we were to put
bitbake on PYPI and I'm not seeing any help or solutions being offered
to that :(. I'm burning out with the project as things stand, I don't
really want to create new issues.

Cheers,

Richard
Wu Zhenyu June 26, 2023, 9:36 a.m. UTC | #4
> sounds really interesting and I'll have to take a look

Thanks for your interest. What is your thought after taking a look?

> There are some specific issues we'd need to solve if we were to put bitbake on PYPI

If you need some related help, you can @me.

On Fri, Jun 23, 2023 at 10:21:45AM +0100, Richard Purdie wrote:
> On Fri, 2023-06-23 at 17:13 +0800, Wu Zhenyu wrote:
> > Hi, I create a language server for bitbake in <https://github.com/Freed-Wu/bitbake-language-server>.
> > It really need bitbake as a python package to provide the full functions.
> > Now I have to use <https://aur.archlinux.org/packages/python-bitbake> as a dependency.
> > Can you rethink again about packaging it in PYPI?
> 
> A language server sounds really interesting and I'll have to take a
> look. If we add it to PYPI, who is going to deal with the usability
> issues I mentioned, the documentation problem and the resulting support
> where people mismatch bitbake versions?
> 
> There are some specific issues we'd need to solve if we were to put
> bitbake on PYPI and I'm not seeing any help or solutions being offered
> to that :(. I'm burning out with the project as things stand, I don't
> really want to create new issues.
> 
> Cheers,
> 
> Richard
> 
> 
>
diff mbox series

Patch

diff --git a/.gitignore b/.gitignore
index fbf9eb2..c328bcd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,6 @@ 
-*.pyc
-*.pyo
 *~
 pyshtables.py
 /doc/manual/html/
-/build/
 /bin/bitbakec
 *.swp
 tags
@@ -16,3 +13,130 @@  lib/toaster/contrib/tts/backlog.txt
 lib/toaster/contrib/tts/log/*
 lib/toaster/contrib/tts/.cache/*
 lib/bb/tests/runqueue-tests/bitbake-cookerdaemon.log
+
+# create by https://github.com/iamcco/coc-gitignore (Thu Jun 15 2023 22:34:35 GMT+0800 (China Standard Time))
+# Python.gitignore:
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+pip-wheel-metadata/
+share/python-wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+
+# PyInstaller
+#  Usually these files are written by a python script from a template
+#  before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.nox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+.hypothesis/
+.pytest_cache/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+db.sqlite3
+db.sqlite3-journal
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# IPython
+profile_default/
+ipython_config.py
+
+# pyenv
+.python-version
+
+# pipenv
+#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
+#   However, in case of collaboration, if having platform-specific dependencies or dependencies
+#   having no cross-platform support, pipenv may install dependencies that don't work, or not
+#   install all needed dependencies.
+#Pipfile.lock
+
+# celery beat schedule file
+celerybeat-schedule
+
+# SageMath parsed files
+*.sage.py
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# mkdocs documentation
+/site
+
+# mypy
+.mypy_cache/
+.dmypy.json
+dmypy.json
+
+# Pyre type checker
+.pyre/
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index 7616ef5..e5d1cbd 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -32,6 +32,7 @@  import stat
 import bb.server.xmlrpcserver
 from bb import daemonize
 from multiprocessing import queues
+from shutil import which
 
 logger = logging.getLogger('BitBake')
 
@@ -619,7 +620,9 @@  class BitBakeServer(object):
         os.close(self.readypipe)
         os.set_inheritable(self.bitbake_lock.fileno(), True)
         os.set_inheritable(self.readypipein, True)
-        serverscript = os.path.realpath(os.path.dirname(__file__) + "/../../../bin/bitbake-server")
+        serverscript = which("bitbake-server")
+        if serverscript is None:
+            serverscript = os.path.realpath(os.path.dirname(__file__) + "/../../../bin/bitbake-server")
         os.execl(sys.executable, "bitbake-server", serverscript, "decafbad", str(self.bitbake_lock.fileno()), str(self.readypipein), self.logfile, self.bitbake_lock.name, self.sockname,  str(self.server_timeout or 0), str(int(self.profile)), str(self.xmlrpcinterface[0]), str(self.xmlrpcinterface[1]))
 
 def execServer(lockfd, readypipeinfd, lockname, sockname, server_timeout, xmlrpcinterface, profile):
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..988cbb4
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,109 @@ 
+[build-system]
+requires = ["setuptools_scm[toml] >= 6.2"]
+build-backend = "setuptools.build_meta"
+
+# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
+[project]
+name = "bitbake"
+description = ""
+readme = "README.md"
+requires-python = ">= 3.7"
+keywords = ["yocto"]
+version = "2.4.1"
+classifiers = [
+  "Development Status :: 3 - Alpha",
+  "Intended Audience :: Developers",
+  "Topic :: Software Development :: Build Tools",
+  "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
+  "Operating System :: Microsoft :: Windows",
+  "Operating System :: POSIX",
+  "Operating System :: Unix",
+  "Operating System :: MacOS",
+  "Programming Language :: Python :: 3 :: Only",
+  "Programming Language :: Python :: 3",
+  "Programming Language :: Python :: 3.7",
+  "Programming Language :: Python :: 3.8",
+  "Programming Language :: Python :: 3.9",
+  "Programming Language :: Python :: 3.10",
+  "Programming Language :: Python :: 3.11",
+  "Programming Language :: Python :: Implementation :: CPython",
+  "Programming Language :: Python :: Implementation :: PyPy",
+]
+dynamic = ["optional-dependencies"]
+
+[[project.authors]]
+name = "Tim Ansell"
+email = "mithro@mithis.net"
+
+[[project.authors]]
+name = "Phil Blundell"
+email = "pb@handhelds.org"
+
+[[project.authors]]
+name = "Seb Frankengul"
+email = "seb@frankengul.org"
+
+[[project.authors]]
+name = "Holger Freyther"
+email = "holger@moiji-mobile.com"
+
+[[project.authors]]
+name = "Marcin Juszkiewicz"
+email = "marcin@juszkiewicz.com.pl"
+
+[[project.authors]]
+name = "Chris Larson"
+email = "kergoth@handhelds.org"
+
+[[project.authors]]
+name = "Ulrich Luckas"
+email = "luckas@musoft.de"
+
+[[project.authors]]
+name = "Mickey Lauer"
+email = "mickey@Vanille.de"
+
+[[project.authors]]
+name = "Richard Purdie"
+email = "rpurdie@rpsys.net"
+
+[[project.authors]]
+name = "Holger Schurig"
+email = "holgerschurig@gmx.de"
+
+[project.license]
+text = "GPL v2"
+
+[project.urls]
+Homepage = "https://docs.yoctoproject.org/bitbake"
+Download = "https://git.openembedded.org/bitbake"
+"Bug Report" = "https://bugzilla.yoctoproject.org"
+Source = "https://git.openembedded.org/bitbake"
+
+[tool.setuptools]
+script-files = [
+  "bin/bitbake",
+  "bin/bitbake-diffsigs",
+  "bin/bitbake-dumpsig",
+  "bin/bitbake-getvar",
+  "bin/bitbake-hashclient",
+  "bin/bitbake-hashserv",
+  "bin/bitbake-layers",
+  "bin/bitbake-prserv",
+  "bin/bitbake-selftest",
+  "bin/bitbake-server",
+  "bin/bitbake-worker",
+  "bin/git-make-shallow",
+  "bin/toaster",
+  "bin/toaster-eventreplay",
+]
+py-modules = ["codegen", "pyinotify"]
+
+[tool.setuptools.packages.find]
+where = ["lib"]
+
+[tool.setuptools.data-files]
+"share/man/man1" = ["doc/bitbake.1"]
+
+[tool.setuptools.dynamic.optional-dependencies.toaster]
+file = "toaster-requirements.txt"