Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a gentoo ebuild issue #179

Open
Toluk opened this issue Nov 6, 2024 · 3 comments
Open

a gentoo ebuild issue #179

Toluk opened this issue Nov 6, 2024 · 3 comments

Comments

@Toluk
Copy link

Toluk commented Nov 6, 2024

Hello.

I was trying to create a gentoo portage ebuild for this python package and encountered an issue. Which could be bypassed by such patch:

--- a/setup.py
+++ b/setup.py
@@ -32,7 +32,7 @@ except (OSError, subprocess.CalledProcessError, IOError):
             exec(f.read(), d)
             version = d['__version__']
     except IOError:
-        version = 'unknown'
+        version = '0.5.7'


 with open('README.rst') as f:

Im not sure if this is important to begin with, but decided i should report about it.

@hthiery
Copy link
Contributor

hthiery commented Nov 7, 2024

do you know how to solve the problem in general?

@Toluk
Copy link
Author

Toluk commented Nov 7, 2024

In setup.py

except (OSError, subprocess.CalledProcessError, IOError):
    try:
        with open(version_py, 'r') as f:
            d = dict()
            exec(f.read(), d)
            version = d['__version__']
    except IOError:
        version = 'unknown'

in my case this block of code falls into "version = 'unknown'" and breaks something in setuptools (my guess), may be for stable releases (or tags in general) just switch this try-except block for direct version value ? Imo it looks overcomplicated.
May be the problem is that i dont install this package through pip. I have limited knowledge of pip installation.

@Toluk
Copy link
Author

Toluk commented Nov 7, 2024

I'm learning how to write them, so nothing overcomplicated so far, looked at some examples and ended up with this, and it seems to work.
python-ipmi-0.5.7.ebuild

# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{7..13} )
DISTUTILS_USE_PEP517=setuptools
inherit distutils-r1

DESCRIPTION="Pure Python IPMI Library"
HOMEPAGE="https://github.com/kontron/python-ipmi"
SRC_URI="https://github.com/kontron/${PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64"

DEPEND=""
RDEPEND="${DEPEND}"

src_prepare() {
    eapply "${FILESDIR}/version2.patch"
    eapply_user
}

and version2.patch

except (OSError, subprocess.CalledProcessError, IOError):
    try:
        with open(version_py, 'r') as f:
            d = dict()
            exec(f.read(), d)
            version = d['__version__']
    except IOError:
        version = 'unknown'

metadata.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
  <maintainer type="person">
    <email>[email protected]</email>
    <name>Heiko Thiery</name>
  </maintainer>
  <upstream>
    <remote-id type="github">kontron/python-ipmi</remote-id>
  </upstream>
</pkgmetadata>

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

No branches or pull requests

2 participants