Bug 2058411 - Review Request: python-tcolorpy - Python library to apply true color for terminal text
Summary: Review Request: python-tcolorpy - Python library to apply true color for term...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 2049642
TreeView+ depends on / blocked
 
Reported: 2022-02-24 20:41 UTC by Jonny Heggheim
Modified: 2022-02-25 22:06 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-02-25 22:06:31 UTC
Type: ---
Embargoed:
mhroncok: fedora-review+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github thombashi tcolorpy issues 2 0 None open Please remove shebang from __main__.py 2022-02-25 12:19:57 UTC

Description Jonny Heggheim 2022-02-24 20:41:55 UTC
Spec URL: https://jonny.fedorapeople.org/python-tcolorpy.spec
SRPM URL: https://jonny.fedorapeople.org/python-tcolorpy-0.1.1-1.fc35.src.rpm

Description:
Python library to apply true color for terminal text.

Fedora Account System Username: jonny

Comment 1 Jonny Heggheim 2022-02-24 20:41:58 UTC
This package built on koji:  https://koji.fedoraproject.org/koji/taskinfo?taskID=83283547

Comment 2 Miro Hrončok 2022-02-24 22:40:51 UTC
Any chance to have this packaged using the new set of macros? https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_empty_spec_file

I can help with that.

Comment 3 Miro Hrončok 2022-02-24 22:41:42 UTC
I've meant to paste https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_example_spec_file -- both links are relevant but this one is more understandable.

Comment 4 Jonny Heggheim 2022-02-25 00:58:42 UTC
Thanks, I did not know about these new rpm macros, will let you know when I have updated the spec file.

Comment 5 Jonny Heggheim 2022-02-25 01:41:57 UTC
I am running into unknown issue when running the build with -t flag for %pyproject_buildrequires.

I am able to get it working when removing the -t flag and explicit adding dependency on pytest.


___________________________________ summary ____________________________________
  py310: commands succeeded
  congratulations :)
Handling .[test] from tox --print-deps-only: py310
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/packaging/requirements.py", line 102, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/usr/lib/python3.10/site-packages/pyparsing.py", line 1955, in parseString
    raise exc
  File "/usr/lib/python3.10/site-packages/pyparsing.py", line 3250, in parseImpl
    raise ParseException(instring, loc, self.errmsg, self)
pyparsing.ParseException: Expected W:(abcd...), found '.'  (at char 0), (line:1, col:1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 111, in add
    requirement = Requirement(requirement_str)
  File "/usr/lib/python3.10/site-packages/packaging/requirements.py", line 104, in __init__
    raise InvalidRequirement(
packaging.requirements.InvalidRequirement: Parse error at "'.[test]'": Expected W:(abcd...)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 428, in main
    generate_requires(
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 358, in generate_requires
    generate_tox_requirements(toxenv, requirements)
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 313, in generate_tox_requirements
    requirements.extend(packages,
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 184, in extend
    self.add(req_str, **kwargs)
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 117, in add
    raise ValueError(message)
ValueError: Requirement '.[test]' from tox --print-deps-only: py310 is invalid.


RPM build errors:
error: Bad exit status from /var/tmp/rpm-tmp.4IS6s3 (%generate_buildrequires)
    Bad exit status from /var/tmp/rpm-tmp.4IS6s3 (%generate_buildrequires)
Finish: rpmbuild python-tcolorpy-0.1.1-1.fc35.src.rpm
Finish: build phase for python-tcolorpy-0.1.1-1.fc35.src.rpm
ERROR: Exception(/home/jonny/rpmbuild/SRPMS/python-tcolorpy-0.1.1-1.fc35.src.rpm) Config(fedora-rawhide-x86_64) 0 minutes 35 seconds
INFO: Results and/or logs in: /var/lib/mock/fedora-rawhide-x86_64/result
ERROR: Command failed: 
 # ['bash', '--login', '-c', '/usr/bin/rpmbuild -br --target x86_64 --nodeps /builddir/build/SPECS/python-tcolorpy.spec']

Comment 6 Jonny Heggheim 2022-02-25 02:11:21 UTC
I have updated the spec and srpm with %pyproject macros. The %srcname tcolorpy definition have been removed since it seems like it is not used anymore.

As earlier comment, I was not able to use the -t flag with the %pyproject_buildrequires macro.

Comment 7 Miro Hrončok 2022-02-25 10:32:11 UTC
The -t option is broken because the "deps" section in tox.ini references self (via dot). We cannot (yet?) parse that.

Here is a workaround/fix (depending on your viewpoint): https://github.com/thombashi/tcolorpy/pull/1



Alternatively to -t, you can use:

    %pyproject_buildrequires -x test


However, both options will give you a requirement on pytest-md-report which is not packaged in Fedora and apparently not really needed. So manually specifying the pytest dep is completely fine.


I would however add a comment about the situation. Something like:

# tox.ini uses the [test] extra, see also https://github.com/thombashi/tcolorpy/pull/1
# the [test] extra brings in just pytest and pytest-md-report and we don't need the latter
# hence, manually specifying pytest instead:
BuildRequires: python3-pytest

Comment 8 Miro Hrončok 2022-02-25 10:46:47 UTC
Package Review
==============


python3-tcolorpy.noarch: E: non-executable-script /usr/lib/python3.10/site-packages/tcolorpy/__main__.py 644 /usr/bin/env python3

Please remove shebang from that file (preferably in upstream first)). It makes no sense there:

 - the file is not executable, hence the shebang does nothing
 - even if it was executable, nobody executes this by going to terminal and running the file, it is a Python module
 - the purpose of this file is to allow executing `python -m tcolorpy` which doe snot require a shebang


Other than that, all good, see below:


Legend:
[x] = Pass, [!] = Fail, [-] = Not applicable, [?] = Not evaluated



===== 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.
[x]: License field in the package spec file matches the actual license.
     Note: Checking patched sources after %prep for licenses. Licenses
     found: "MIT License", "Unknown or generated", "*No copyright* MIT
     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]: 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 %license.
[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]: 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]: Dist tag is present.
[x]: Package does not contain duplicates in %files.
[x]: Permissions on files are set properly.
[x]: Package must not depend on deprecated() packages.
[x]: Package use %makeinstall only when make install DESTDIR=... doesn't
     work.
[x]: Package is named using only allowed ASCII characters.
[x]: Package does not use a name that already exists.
[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.
[x]: A package which is used by another package via an egg interface should
     provide egg info.
[x]: Package meets the Packaging Guidelines::Python
[x]: Package contains BR: python2-devel or python3-devel
[x]: Packages MUST NOT have dependencies (either build-time or runtime) on
     packages named with the unversioned python- prefix unless no properly
     versioned package exists. Dependencies on Python packages instead MUST
     use names beginning with python2- or python3- as appropriate.
[x]: Python packages must not contain %{pythonX_site(lib|arch)}/* in %files
[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).
[?]: Package functions as described.
[?]: Latest version is packaged.
[x]: Package does not include license text files separate from upstream.
[-]: Sources are verified with gpgverify first in %prep if upstream
     publishes signatures.
[?]: Package should compile and build into binary rpms on all supported
     architectures.
[x]: %check is present and all tests pass.
[?]: Packages should try to preserve timestamps of original installed
     files.
[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]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin.
[x]: Packager, Vendor, PreReq, Copyright tags should not be in spec file
[x]: Sources can be downloaded from URI in Source: tag
[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
-------
============================ rpmlint session starts ============================
rpmlint: 2.2.0
configuration:
    /usr/lib/python3.10/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/licenses.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
checks: 32, packages: 2

python3-tcolorpy.noarch: E: non-executable-script /usr/lib/python3.10/site-packages/tcolorpy/__main__.py 644 /usr/bin/env python3
 2 packages and 0 specfiles checked; 1 errors, 0 warnings, 1 badness; has taken 0.9 s 



Rpmlint (installed packages)
----------------------------
Same as above.


Source checksums
----------------
https://files.pythonhosted.org/packages/source/t/tcolorpy/tcolorpy-0.1.1.tar.gz :
  CHECKSUM(SHA256) this package     : 33abe296af468582a2c4d4666761ee58a38935601699a61fb148f576cf648af8
  CHECKSUM(SHA256) upstream package : 33abe296af468582a2c4d4666761ee58a38935601699a61fb148f576cf648af8


Requires
--------
python3-tcolorpy (rpmlib, GLIBC filtered):
    python(abi)



Provides
--------
python3-tcolorpy:
    python-tcolorpy
    python3-tcolorpy
    python3.10-tcolorpy
    python3.10dist(tcolorpy)
    python3dist(tcolorpy)



Generated by fedora-review 0.7.0 (fed5495) last change: 2019-03-17
Command line :try-fedora-review -b 2058411 -m fedora-rawhide-x86_64
Buildroot used: fedora-rawhide-x86_64
Active plugins: Generic, Python, Shell-api
Disabled plugins: Ocaml, SugarActivity, Java, PHP, fonts, Ruby, Haskell, R, Perl, C/C++
Disabled flags: EPEL6, EPEL7, DISTTAG, BATCH, EXARCH

Comment 9 Jonny Heggheim 2022-02-25 12:19:58 UTC
(In reply to Miro Hrončok from comment #8)
> Package Review
> ==============
> 
> 
> python3-tcolorpy.noarch: E: non-executable-script
> /usr/lib/python3.10/site-packages/tcolorpy/__main__.py 644 /usr/bin/env
> python3
> 
> Please remove shebang from that file (preferably in upstream first)).

Reported upstream: https://github.com/thombashi/tcolorpy/issues/2


> Other than that, all good, see below:

Thanks, will make a patch or run a sed command while waiting for upstream

Comment 10 Jonny Heggheim 2022-02-25 12:32:28 UTC
I have uploaded the srpm and spec file with your comments, could you update the review flat to plus (+)?

Comment 11 Miro Hrončok 2022-02-25 14:52:54 UTC
> Reported upstream: https://github.com/thombashi/tcolorpy/issues/2

You can send them a PR as well ;)

> sed -i '1d' tcolorpy/__main__.py

This is very dangerous if you forget to remove it once they remove it.
What about:

sed -i '1!b;/^#!/d' tcolorpy/__main__.py

Other than that, the package is APPROVED.

Comment 12 Gwyn Ciesla 2022-02-25 21:45:36 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/python-tcolorpy

Comment 13 Jonny Heggheim 2022-02-25 21:57:40 UTC
(In reply to Miro Hrončok from comment #11)
> > Reported upstream: https://github.com/thombashi/tcolorpy/issues/2
> 
> You can send them a PR as well ;)

That is true, added one.

> > sed -i '1d' tcolorpy/__main__.py
> 
> This is very dangerous if you forget to remove it once they remove it.
> What about:
> 
> sed -i '1!b;/^#!/d' tcolorpy/__main__.py
> 
> Other than that, the package is APPROVED.

Thanks, I changed the sed command to use patch based on PR instead


Note You need to log in before you can comment on or make changes to this bug.