Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 317029 - x11-misc/xac: Verify and potentially improve Python-related code
Summary: x11-misc/xac: Verify and potentially improve Python-related code
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Joe Jezak (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 308257
  Show dependency tree
 
Reported: 2010-04-24 18:49 UTC by Arfrever Frehtes Taifersar Arahesis (RETIRED)
Modified: 2015-10-03 09:29 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
ebuild patch (xac.patch,1.21 KB, text/plain)
2011-11-15 21:39 UTC, Ian Delaney (RETIRED)
Details
revised ebuild patch (xac.patch,1.17 KB, patch)
2011-11-15 22:21 UTC, Ian Delaney (RETIRED)
Details | Diff
revised ebuild patch (xac.patch,1.17 KB, patch)
2011-11-17 16:32 UTC, Ian Delaney (RETIRED)
Details | Diff
revised ebuild patch (xac.patch,1.71 KB, patch)
2011-11-18 08:19 UTC, Ian Delaney (RETIRED)
Details | Diff
r (xac.patch,1.74 KB, patch)
2011-11-19 10:39 UTC, Ian Delaney (RETIRED)
Details | Diff
revised ebuild patch (xac.patch,1.52 KB, patch)
2011-11-21 15:59 UTC, Ian Delaney (RETIRED)
Details | Diff
ebuild patch (xac.patch,1.80 KB, patch)
2011-11-25 13:28 UTC, Ian Delaney (RETIRED)
Details | Diff
revised ebuild patch (xac.patch,1.91 KB, patch)
2011-11-26 12:34 UTC, Ian Delaney (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-04-24 18:49:44 UTC
- If this package can be used as a library and installs Python modules
  (*.so or *.py) into site-packages directories, then consider supporting
  installation for multiple Python versions.
  Please read section "Types of packages" in documentation [1] to decide
  if this package can support installation for multiple Python versions.

- Ensure that the ebuilds do not use deprecated functions or variables.

- Please check if Python 3 is supported by this package. You can temporarily
  set Python 3 as main active version of Python to properly test if this
  package supports Python 3.

- If this package does not support Python 3:
  - Specify dependency on Python 2.
    You can use PYTHON_DEPEND helper variable, which should be set before
    inheriting of python eclass.
    Please read section "Specification of dependency on Python" in
    documentation [1].

  - If this package cannot support installation for multiple versions of
    Python, then set active version of Python using
    python_set_active_version().

  - Ensure that shebangs in installed scripts specify correct version of
    Python. If shebangs are too generic (e.g. '#!/usr/bin/python'), then you
    can use python_convert_shebangs() to convert shebangs.
    (Wrapper scripts generated by python_generate_wrapper_scripts() do not
    require any changes.)
    Please read section "Shebangs in installed scripts" in documentation [1].

  - To ensure that changes applied to the ebuilds are sufficient, please
    temporarily set Python 3 as main active version of Python and test if
    this package can be properly installed and if it works at run time.

Please see documentation [1] for more details.
[1] http://www.gentoo.org/proj/en/Python/developersguide.xml
Comment 1 Ian Delaney (RETIRED) gentoo-dev 2011-11-15 21:39:33 UTC
Created attachment 292689 [details]
ebuild patch

xac doesn't work.  Can't import a pci module. DEPENDS on python2
Comment 2 Ian Delaney (RETIRED) gentoo-dev 2011-11-15 22:21:10 UTC
Created attachment 292703 [details, diff]
revised ebuild patch
Comment 3 Arfrever Frehtes Taifersar Arahesis 2011-11-16 19:32:43 UTC
(In reply to comment #2)

PYTHON_DEPEND="2"
distutils.eclass should be used.
Comment 4 Ian Delaney (RETIRED) gentoo-dev 2011-11-17 16:32:15 UTC
Created attachment 292913 [details, diff]
revised ebuild patch
Comment 5 Arfrever Frehtes Taifersar Arahesis 2011-11-18 05:21:25 UTC
(In reply to comment #4)

distutils.eclass inherits python.eclass, so python.eclass doesn't need to be explicitly inherited.

Don't set RESTRICT_PYTHON_ABIS variable if it is unused.

If 'python_convert_shebangs -r 2 "${ED}"' is needed, then it should be called after installation of scripts into "${ED}".

This patch causes "distutils_pkg_postinst() called illegally" error.

'chmod +x "${S}/src/setup.py"' should be deleted.

-	./setup.py build || die "Failed to build the C modules"
+	distutils_src_compile

-	./setup.py install --root "${D}" || die "Failed to install the C modules"
+	distutils_src_install

(DISTUTILS_SETUP_FILES could be used.)
Comment 6 Ian Delaney (RETIRED) gentoo-dev 2011-11-18 08:19:13 UTC
Created attachment 292967 [details, diff]
revised ebuild patch

gentoo64 xac # grep DISTUTILS_SETUP_FILES  $PORTDIR/eclass/distutils.eclass
# @ECLASS-VARIABLE: DISTUTILS_SETUP_FILES

 * QA Notice: command not found:
 * 
 *      /mnt/gen2/tmpdir/portage/x11-misc/xac-0.6_pre4/temp/environment: line 2997: DISTUTILS_SETUP_FILES: command not found

strange.

running install_egg_info
Writing /mnt/gen2/tmpdir/portage/x11-misc/xac-0.6_pre4/image/usr/lib64/python2.7/site-packages/pci-1.0-py2.7.egg-info
 * Converting shebang in '/mnt/gen2/tmpdir/portage/x11-misc/xac-0.6_pre4/image/usr/sbin/xac'
 * Converting shebang in '/mnt/gen2/tmpdir/portage/x11-misc/xac-0.6_pre4/image/usr/lib64/xac/arch.py'

--- replaced dir /usr/lib64
--- replaced dir /usr
>>> Original instance of package unmerged safely.
>>> x11-misc/xac-0.6_pre4 merged.
Comment 7 Arfrever Frehtes Taifersar Arahesis 2011-11-19 01:32:33 UTC
(In reply to comment #6)

DISTUTILS_SETUP_FILES is an array, not function.
DISTUTILS_SETUP_FILES=("src|setup.py") would cause automatic change of current directory to "src" before running setup.py commands, so 'cd "${S}"/src' could be removed.

Don't define src_postint() function. Package managers don't use such a function.
Comment 8 Ian Delaney (RETIRED) gentoo-dev 2011-11-19 10:39:38 UTC
Created attachment 293077 [details, diff]
r

figured it, should have kmown a capitalised term is an array.  not seen it b4.
And src_postint; was setting src_in place of pkg_.  practice practice
Comment 9 Arfrever Frehtes Taifersar Arahesis 2011-11-20 06:38:48 UTC
(In reply to comment #8)
> should have kmown a capitalised term is an array.

Bash allows lower-case arrays and upper-case functions.

> And src_postint; was setting src_in place of pkg_.

This patch still contains src_postint().

If both python_set_active_version() and python_pkg_setup() are called, then python_set_active_version() should always be called before python_pkg_setup().

Other inherited eclasses don't export phase functions, so please delete:
src_compile() { distutils_src_compile; }
pkg_postinst() { distutils_pkg_postinst; }
Comment 10 Ian Delaney (RETIRED) gentoo-dev 2011-11-21 15:59:53 UTC
Created attachment 293333 [details, diff]
revised ebuild patch
Comment 11 Arfrever Frehtes Taifersar Arahesis 2011-11-23 19:49:44 UTC
(In reply to comment #10)

You should still use distutils.eclass as in patch from comment #8.
Start with patch from comment #8 and only apply suggestions from comment #9.
Comment 12 Ian Delaney (RETIRED) gentoo-dev 2011-11-25 13:28:36 UTC
Created attachment 293707 [details, diff]
ebuild patch

After much deliberation; it works anyway
Comment 13 Arfrever Frehtes Taifersar Arahesis 2011-11-25 23:13:22 UTC
(In reply to comment #12)

Also inherit multilib.eclass.

Delete '>=dev-lang/python-2.3' from DEPEND/RDEPEND.

pkg_setup() {
	python_set_active_version 2
	python_pkg_setup
}

pkg_postinst() {
	python_mod_optimize /usr/$(get_libdir)/xac
}

pkg_postrm() {
	python_mod_cleanup /usr/$(get_libdir)/xac
}
Comment 14 Ian Delaney (RETIRED) gentoo-dev 2011-11-26 12:34:39 UTC
Created attachment 293825 [details, diff]
revised ebuild patch
Comment 15 Pacho Ramos gentoo-dev 2015-10-03 09:29:47 UTC
This approach was changed by the -r1 python eclasses