Bug 810376

Summary: Review Request: python-pypng - Python PNG encoder/decoder
Product: [Fedora] Fedora Reporter: Matthew Miller <mattdm>
Component: Package ReviewAssignee: Zbigniew Jędrzejewski-Szmek <zbyszek>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: kalevlember, loganjerry, package-review, pviktori, zaitcev, zbyszek
Target Milestone: ---Flags: zbyszek: fedora-review?
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-05-12 17:03:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Matthew Miller 2012-04-05 19:28:36 UTC
Spec URL: http://mattdm.org/misc/fedora/pypng.spec
SRPM URL: http://mattdm.org/misc/fedora/pypng-0.0.12-1.fc16.mattdm.src.rpm
Description: Python PNG encoder/decoder

Comment 1 Kalev Lember 2012-04-06 12:02:37 UTC
Taking for review.

Before going any further, I have a question about the naming of this package. Is there a chance that this will support Python 3 in the future? Because if it is going to, it might make sense to call this 'python-png', making it possible to consistently call the Python 3 version 'python3-png', whenever the Python 3 version becomes supported.

Completely up to you whether to call this 'pypng' or 'python-png', just pointing out the alternative.

http://fedoraproject.org/wiki/Packaging:NamingGuidelines#Addon_Packages_.28python_modules.29

Comment 2 Matthew Miller 2012-04-06 13:31:57 UTC
(In reply to comment #1)
> Completely up to you whether to call this 'pypng' or 'python-png', just
> pointing out the alternative.

Thanks. I have a preference for "pypng", because people tend to call it that; e.g.:


http://ianwitham.wordpress.com/2009/12/12/pypng-and-the-gimp/
http://www.developer.nokia.com/Community/Discussion/showthread.php?188977-pypng-and-graphics.Image
http://stackoverflow.com/questions/7863932/horizontal-flip-of-image-on-python-with-pypng
http://blog.zillabyte.com/hue-histograms/

and so if people are looking to see if there's a Fedora package, that's probably the first thing they'll look for.

Comment 3 Kalev Lember 2012-04-06 14:20:47 UTC
(In reply to comment #2)
> I have a preference for "pypng", because people tend to call it that

Fair enough.


The main issue I see with this package is that its licensing is unclear. code/png.py appears to be MIT-licensed, but the rest of the code files don't have any licensing information. There's also no readme to clear this up.

Could you ask upstream to clarify licensing and add license headers to code files?


Also some comments about the spec file:

RPM doesn't have automatic python dep extraction, so this package will have to manually specify Requires for other python modules it uses. numpy at least is missing from Requires, perhaps something else as well.


> %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}

python_sitelib is automatically defined by rpm macros in all supported Fedora releases so no need to define it in the spec file.
https://fedoraproject.org/wiki/Packaging:Python#Macros


> Source0: http://pypng.googlecode.com/files/pypng-0.0.12.tar.gz

Use the %{version} macro here. With this, when updating to a new upstream release, you'll only need to update the Version: tag and the source URL won't need updating each time.


> %build
> # Remove CFLAGS=... for noarch packages (unneeded)
> CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build

This _is_ a noarch package, so CFLAGS aren't needed here.


> %install
> rm -rf $RPM_BUILD_ROOT

The rm -rf isn't needed with the version of rpmbuild in supported Fedora releases.

Comment 4 Petr Viktorin (pviktori) 2012-10-19 09:59:50 UTC
> RPM doesn't have automatic python dep extraction, so this package will have to manually specify Requires for other python modules it uses. numpy at least is missing from Requires, perhaps something else as well.

numpy is a "soft dependency", it speeds things up but the library works without it.

Comment 5 Jerry James 2013-08-14 16:25:10 UTC
The URLs for the spec file and SRPM are now broken links.  Can you update with working URLs?

Comment 6 Petr Viktorin (pviktori) 2013-08-14 16:36:45 UTC
Note that upstream has moved to Github: https://code.google.com/p/pypng/
Also, they've clarified the licensing: https://github.com/drj11/pypng/pull/14

Comment 7 Matthew Miller 2013-08-14 17:36:51 UTC
Wooo. Okay, thanks. I'll work on updating this.

Comment 8 Zbigniew Jędrzejewski-Szmek 2013-10-04 20:15:12 UTC
(In reply to Matthew Miller from comment #2)
> (In reply to comment #1)
> > Completely up to you whether to call this 'pypng' or 'python-png', just
> > pointing out the alternative.
> 
> Thanks. I have a preference for "pypng", because people tend to call it
> that; e.g.:
Please rename it to python-png or python-pypng. It's better to do it now, than in a few months when python 3 version is added. It is only a question of time before that happens.

Comment 9 Matthew Miller 2013-10-04 20:25:22 UTC
How much had I forgotten all about this? A lot. Sorry. Will put it on my near-term todo list. 

(In reply to Zbigniew Jędrzejewski-Szmek from comment #8)
> Please rename it to python-png or python-pypng. It's better to do it now,
> than in a few months when python 3 version is added. It is only a question
> of time before that happens.

Have the guidelines changed on this?

Comment 10 Zbigniew Jędrzejewski-Szmek 2013-10-04 21:19:40 UTC
(In reply to Matthew Miller from comment #9)
> How much had I forgotten all about this? A lot. Sorry. Will put it on my
> near-term todo list. 
> 
> (In reply to Zbigniew Jędrzejewski-Szmek from comment #8)
> > Please rename it to python-png or python-pypng. It's better to do it now,
> > than in a few months when python 3 version is added. It is only a question
> > of time before that happens.
> 
> Have the guidelines changed on this?
No, I don't think so. The guidelines for "add-on modules" are:

  Packages of python modules (thus they rely on python as a parent) use a
  slightly different naming scheme. They should take into account the upstream 
  name of the python module. This makes a package name format of python-$NAME.

  ...

  So all python3 modules MUST have python3 in their name. Other than that,
  the module must be in the same format as the python2 package.

Anyway, the alternative — pyglet and python3-pyglet — seems quite confusing. I think that this approach is only used for existing packages, all new packages use the python- and python3- prefixes.

Comment 11 Matthew Miller 2013-10-15 00:16:40 UTC
Hey look, an update!


Spec URL: http://mattdm.org/misc/fedora/python-pypng.spec
SRPM URL: http://mattdm.org/misc/fedora/python-pypng-0.0.16-1.fc19.src.rpm

Comment 12 Pete Zaitcev 2014-01-05 00:40:32 UTC
Mattew, any plans for python3-pypng? I threw together a quick-fix SPEC
based on yours:
 http://people.redhat.com/zaitcev/tmp/python-pypng-0.0.16-1.z1.spec

Comment 13 Zbigniew Jędrzejewski-Szmek 2014-01-05 00:49:55 UTC
Does anyone mind if I take over the review?

Comment 14 Kalev Lember 2014-02-06 21:44:02 UTC
Zbigniew, please do, I don't mind at all.

Comment 15 Zbigniew Jędrzejewski-Szmek 2014-02-07 03:45:03 UTC
Nice and clean, with minor issues:

Issues:
=======
- Upstream URL has changed to https://github.com/drj11/pypng

- BR should be changed to python2-devel according to the Python Guidelines

- %check could run nosetests png.py

- It would be great to incorporate the changes to add python3-pypng from comment #12.


===== MUST items =====

Generic:
[x]: Package is licensed with an open-source compatible license and meets
     other legal requirements as defined in the legal section of Packaging
     Guidelines.
[!]: If (and only if) the source package includes the text of the license(s)
     in its own file, then that file, containing the text of the license(s)
     for the package is included in %doc.
%doc LICENCE can be added

[x]: License field in the package spec file matches the actual license.
[x]: Package contains no bundled libraries without FPC exception.
[x]: Changelog in prescribed format.
[x]: Sources contain only permissible code or content.
[-]: Package contains desktop file if it is a GUI application.
[-]: Development files must be in a -devel package
[x]: Package uses nothing in %doc for runtime.
[x]: Package consistently uses macros (instead of hard-coded directory names).
[x]: Package is named according to the Package Naming Guidelines.
[x]: Package does not generate any conflict.
[x]: Package obeys FHS, except libexecdir and /usr/target.
[-]: If the package is a rename of another package, proper Obsoletes and
     Provides are present.
[x]: Requires correct, justified where necessary.
[x]: Spec file is legible and written in American English.
[-]: Package contains systemd file(s) if in need.
[x]: Package is not known to require an ExcludeArch tag.
[-]: Large documentation must go in a -doc subpackage. Large could be size
     (~1MB) or number of files.
     Note: Documentation size is 10240 bytes in 1 files.
[x]: Package complies to the Packaging Guidelines
[x]: Package successfully compiles and builds into binary rpms on at least one
     supported primary architecture.
[x]: Package installs properly.
[x]: Rpmlint is run on all rpms the build produces.
     Note: There are rpmlint messages (see attachment).
[x]: Package requires other packages for directories it uses.
[x]: Package must own all directories that it creates.
[x]: Package does not own files or directories owned by other packages.
[x]: All build dependencies are listed in BuildRequires, except for any that
     are listed in the exceptions section of Packaging Guidelines.
[x]: Package uses either %{buildroot} or $RPM_BUILD_ROOT
[x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
[x]: Macros in Summary, %description expandable at SRPM build time.
[x]: Package does not contain duplicates in %files.
[x]: Permissions on files are set properly.
[x]: Package use %makeinstall only when make install' ' DESTDIR=... doesn't
     work.
[x]: Package is named using only allowed ASCII characters.
[x]: Package do not use a name that already exist
[x]: Package is not relocatable.
[x]: Sources used to build the package match the upstream source, as provided
     in the spec URL.
[x]: Spec file name must match the spec package %{name}, in the format
     %{name}.spec.
[x]: File names are valid UTF-8.
[x]: Packages must not store files under /srv, /opt or /usr/local

Python:
[x]: Python eggs must not download any dependencies during the build process.
[-]: A package which is used by another package via an egg interface should
     provide egg info.
[x]: Package meets the Packaging Guidelines::Python
[x]: Binary eggs must be removed in %prep

===== SHOULD items =====

Generic:
[-]: If the source package does not include license text(s) as a separate file
     from upstream, the packager SHOULD query upstream to include it.
[x]: Final provides and requires are sane (see attachments).
[x]: Package functions as described.
[x]: Latest version is packaged.
[x]: Package does not include license text files separate from upstream.
[-]: Description and summary sections in the package spec file contains
     translations for supported Non-English languages, if available.
[x]: Package should compile and build into binary rpms on all supported
     architectures.
[?]: %check is present and all tests pass.
[x]: Packages should try to preserve timestamps of original installed files.
[x]: Packager, Vendor, PreReq, Copyright tags should not be in spec file
[x]: Sources can be downloaded from URI in Source: tag
[x]: Reviewer should test that the package builds in mock.
[x]: Buildroot is not present
[x]: Package has no %clean section with rm -rf %{buildroot} (or
     $RPM_BUILD_ROOT)
[x]: Dist tag is present (not strictly required in GL).
[x]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin.
[x]: SourceX is a working URL.
[x]: Spec use %global instead of %define unless justified.

===== EXTRA items =====

Generic:
[x]: Rpmlint is run on all installed packages.
     Note: There are rpmlint messages (see attachment).
[x]: Spec file according to URL is the same as in SRPM.


Rpmlint
-------
Checking: python-pypng-0.0.16-1.fc20.noarch.rpm
          python-pypng-0.0.16-1.fc20.src.rpm
python-pypng.noarch: E: non-executable-script /usr/lib/python2.7/site-packages/png.py 0644L /usr/bin/env
python-pypng.src:7: W: mixed-use-of-spaces-and-tabs (spaces: line 3, tab: line 7)
2 packages and 0 specfiles checked; 1 errors, 1 warnings.

Requires
--------
python-pypng (rpmlib, GLIBC filtered):
    python(abi)

Provides
--------
python-pypng:
    python-pypng



Source checksums
----------------
https://github.com/drj11/pypng/archive/pypng-0.0.16.zip :
  CHECKSUM(SHA256) this package     : 195c78926ed2e2864cc85a08e5515d19a67d45c3d8199b964ae9d4474cc7469f
  CHECKSUM(SHA256) upstream package : 195c78926ed2e2864cc85a08e5515d19a67d45c3d8199b964ae9d4474cc7469f


Generated by fedora-review 0.5.1 (bb9bf27) last change: 2013-12-13
Command line :/usr/bin/fedora-review -n python-pypng
Buildroot used: fedora-20-x86_64
Active plugins: Python, Generic, Shell-api
Disabled plugins: Java, C/C++, fonts, SugarActivity, Ocaml, Perl, Haskell, R, PHP, Ruby
Disabled flags: EXARCH, EPEL5, BATCH, DISTTAG

Comment 16 Matthew Miller 2014-02-07 08:59:37 UTC
Whoo, thanks everyone. I'm in Brno at DevConf right now, but I'll try to get to the updates RSN. Pete, do you want to be a co-maintainer? I'm still interested but I literally forget what project I wanted this for in the first place. :)

Comment 17 Jerry James 2014-02-07 18:39:18 UTC
Please pardon yet another 3rd party jumping in with proposed spec file enhancements:

http://jjames.fedorapeople.org/pypng/

This incorporates all of the suggestions above, and also:
- Uses upstream's tar.gz release instead of its zip release
- Enables the optional Cython interface, which can speed up png file reading
- Ships the example code
- Preserves timestamps when removing /usr/bin/env
- Builds the documentation with Sphinx
- Cleans up the python3 build dir

It does NOT ship both python2 and python3 versions of the examples, because that just seems too complicated....

Comment 18 Pete Zaitcev 2014-02-07 19:44:47 UTC
(In reply to Matthew Miller from comment #16)
> Pete, do you want to be a co-maintainer?
Yeah, I'll take it. If Spot maintains 300 packages...

Comment 19 Matthew Miller 2014-02-14 18:00:38 UTC
Pete / Zbigniew, what do you think of Jerry's changes? I'm kind of thinking we should get the initial package through review as Pete's version, and then add Jerry's enhancements in rawhide.

Comment 20 Zbigniew Jędrzejewski-Szmek 2014-02-14 18:28:52 UTC
(In reply to Matthew Miller from comment #19)
> Pete / Zbigniew, what do you think of Jerry's changes? I'm kind of thinking
> we should get the initial package through review as Pete's version
Both should be OK... But why wait, let's incorporate the changes now while they're hot.

Comment 21 Matthew Miller 2014-02-14 18:40:37 UTC
I'm a little worried about the non-upstreamed changes, simply because I don't have time to test them and that seems a little irresponsible. But if you all think it's good I'm fine with full-steam ahead. :)

Comment 22 Zbigniew Jędrzejewski-Szmek 2015-05-09 14:44:43 UTC
Ping?

Comment 23 Matthew Miller 2015-05-11 19:58:19 UTC
Oh hi. Thanks for the ping. (png? hmm.) Updated to newest upstream version:


Spec URL: http://mattdm.org/misc/fedora/python-pypng.spec
SRPM URL: http://mattdm.org/misc/fedora/python-pypng-0.0.17-1.fc22.mattdm.src.rpm

What is the correct thing to do with python3 at this point? The readme notes



PyPNG also works on Python 3.x if you use the 2to3 tool which it should
do automatically (this support is very recent, and preliminary). I assume that should be done and a python3 subpackage created?

Comment 24 Zbigniew Jędrzejewski-Szmek 2015-05-12 17:03:14 UTC
That's embarrassing.

*** This bug has been marked as a duplicate of bug 1096350 ***

Comment 25 Matthew Miller 2015-05-12 17:04:30 UTC
(In reply to Zbigniew Jędrzejewski-Szmek from comment #24)
> That's embarrassing.

Heh. Well, happens sometimes. :)

I forget what I even wanted this for, by now. :)

Comment 26 Pete Zaitcev 2015-05-12 21:52:01 UTC
Sadly I know of no alternative. I need to generate some kind of picture
 http://zaitcev.livejournal.com/220516.html
 https://github.com/zaitcev/glie

I'm open to co-maintaining it in Fedora. I don't have a PP bit, but I have
several packages, including Python based.

Comment 27 Matthew Miller 2015-05-12 22:42:35 UTC
Pete, it looks like the package is approved and pushed in the other bug. I'm sure Ralph would be happy for a comaintainer.