Mailinglist Archive: opensuse-packaging (102 mails)

< Previous Next >
Re: [opensuse-packaging] fixes for rpmlint ? python singlespec pyc, opt-1.pyc
On vendredi, 7 avril 2017 16.25:43 h CEST Todd Rme wrote:
On Wed, Apr 5, 2017 at 11:35 AM, Brüns, Stefan

<Stefan.Bruens@xxxxxxxxxxxxxx> wrote:
On Mittwoch, 5. April 2017 16:23:07 CEST Bruno Friedmann wrote:
For any packages build with the new singlespec way there those warnings

[ 21s] RPMLINT report:
[ 21s] ===============
[ 21s] python3-mappyfile.noarch: W: files-duplicate
/usr/lib/python3.6/site-
packages/mappyfile/__pycache__/tokens.cpython-36.pyc
/usr/lib/python3.6/site-
packages/mappyfile/__pycache__/tokens.cpython-36.opt-1.pyc
[ 21s] python3-mappyfile.noarch: W: files-duplicate
/usr/lib/python3.6/site-
packages/mappyfile/__pycache__/__init__.cpython-36.opt-1.pyc /usr/lib/
python3.6/site-packages/mappyfile/__pycache__/__init__.cpython-36.pyc [
21s] python3-mappyfile.noarch: W: files-duplicate
/usr/lib/python3.6/site-
packages/mappyfile-0.2.0-py3.6.egg-info/not-zip-safe
/usr/lib/python3.6/site-
packages/mappyfile-0.2.0-py3.6.egg-info/dependency_links.txt
[ 21s] python3-mappyfile.noarch: W: files-duplicate
/usr/lib/python3.6/site-
packages/mappyfile/__pycache__/ordereddict.cpython-36.opt-1.pyc /usr/lib/
python3.6/site-packages/mappyfile/__pycache__/ordereddict.cpython-36.pyc
[

21s] 3 packages and 0 specfiles checked; 0 errors, 4 warnings.

Should RPMLINT be fixed to become smarter, and just ignore those,
or something still need to be fixed in the python part ?

RPMLINT is right on this, we should not ship duplicate files. The files
are
duplicate because the opt-1 optimization level has no effect on the
bytecode files.

At least run %fdupes -s on the target directory, this will remove
(symlink)
the duplicates.

The next question is, should we even ship both no-optimization and opt-1
bytecode files? The bytecode itself improves startup time significantly,
but the opt-1 is dubious:

- it removes any assert(...) statements. Although may improve speed if
there are assertions in a hot path, I doubt this is a good idea in
general

- opt-1 bytecode files will be ignored until we use "python3 -O1" or set
PYTONOPTIMIZE=1

- if there are no assertions, both bytecode files will be identical

To test it yourself, put the following three files in the same directory,
and execute the tests with:
a) python3 ./opttest.py
b) python3 -O ./opttest.py
c) ./opttest.py
d) PYTHONOPTIMIZE=1 ./opttest.py

---
# optmodule_noassert.py

def test_no_assert():
print("no assertion")

---
# optmodule.py

def test_assert_good():
assert(1)
print("assert good")

def test_assert_fail():
assert(0)
print("assert fail")

---
#! /usr/bin/python3
# opttest.py
import optmodule
import optmodule_noassert

print("opttest")

optmodule_noassert.test_no_assert()
optmodule.test_assert_good()
optmodule.test_assert_fail()
---

Command a) and c) will throw an assertion and generate __pycache__/
optmodule{_noassert}.cpython-36.pyc.

Command b) and d) will throw no assertion and generate __pycache__/
optmodule{_noassert}.cpython-36.opt-1.pyc.

Both optmodule_noassert bytecode files are binary identical.

Kind regards,

Stefan

Can the python singlespec macros be updated to automatically hardlink
or symlink these files?

I've found where we need to be really carefull with singlespecs ....
The fdupes line HAS to be written like this

%python_expand %fdupes %{buildroot}%{$python_sitelib}

Then it works

--

Bruno Friedmann
Ioda-Net Sàrl www.ioda-net.ch
Bareos Partner, openSUSE Member, fsfe fellowship
GPG KEY : D5C9B751C4653227
irc: tigerfoot


--
To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-packaging+owner@xxxxxxxxxxxx

< Previous Next >