Bug 228769

Summary: devel/py-testtools: Add missing dependencies (with workaround for devel/py-fixtures et al.)
Product: Ports & Packages Reporter: Kai Knoblich <kai>
Component: Individual Port(s)Assignee: Po-Chuan Hsieh <sunpoet>
Status: Closed FIXED    
Severity: Affects Only Me CC: python, sunpoet
Priority: --- Flags: bugzilla: maintainer-feedback? (sunpoet)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
py-testtools_RUN_DEPENDS.patch
none
py-testtools_RUN_DEPENDS-v2.patch kai: maintainer-approval? (sunpoet)

Description Kai Knoblich freebsd_committer freebsd_triage 2018-06-05 17:36:54 UTC
Created attachment 194031 [details]
py-testtools_RUN_DEPENDS.patch

Hello,

attached is a patch, that does following modifications:

for port devel/py-testtools:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- adds missing dependencies to RUN_DEPENDS (devel/py-pbr, devel/py-fixtures, devel/py-mimeparse, devel/py-unittest2, devel/py-six)
- adds LICENSE_FILE
- bumps PORTREVISION
- changes occurrences of FLAVOR to PY_FLAVOR

for port devel/py-fixtures:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- removes devel/py-testtools from RUN_DEPENDS to avoid circular dependencies (devel/py-testtools + devel/py-fixtures depends on each other, please see further down below for an explanation)
- adds a comment for the workaround
- changes occurrences of FLAVOR to PY_FLAVOR
- bumps PORTREVISION

for port devel/py-python-subunit:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- removes redundant entries from RUN_DEPENDS
- bumps PORTREVISION
- Note: my approval as maintainer for the change is given

for port devel/py-mox3:
~~~~~~~~~~~~~~~~~~~~~~~
- changes devel/py-fixtures to devel/py-testtools in RUN_DEPENDS
- Note: my approval as maintainer for the change is given


Explanation for the workaround:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As already stated above the ports devel/py-testtools and devel/py-fixtures depends on each other. If those dependencies would be set in the Makefiles of both ports it would introduce a circular depency which

There might be two workarounds to cope with the problem (the attached patch uses option b):

a) Create a test for both ports that check if the port sees itself in the RUN_DEPENDS and remove the entry in that case. But there's no known use-case in the ports tree and this approach might be prone to errors.

b) Break the possibility of a circular dependency by pruning the dependencies on one of the both ports. I did choose devel/py-fixtures because that port is listed as single instance in only one port at the moment (= devel/py-mox3).

The workaround would be now:
- If in the future one port requires devel/py-fixtures without listing devel/py-testtools explicitly then the first one should be replaced with the latter one to resolve the given dependencies (included for devel/py-mox3 in the supplied patch).

What do you think about it?

QA:
~~~
- poudriere (11.1-RELEASE amd64 + i386) for each py27 + py36 flavor -> OK
- portlint -> OK
Comment 1 Po-Chuan Hsieh freebsd_committer freebsd_triage 2018-06-21 15:44:41 UTC
According to upstream of both ports (fixtures and testtools), fixtures as an optional dependency of testtools and testtools is a dependency of fixtures.

In testtools, fixtures are loaded as:

    fixtures = try_import('fixtures')

Therefore, we could avoid circular dependency by not registering fixtures as a dependency of testtools.

For their customers, devel/py-mox3, devel/py-testrepository and devel/py-testresources depend on both ports.
And devel/py-extras, devel/py-python-subunit and www/py-falcon depend on py-testtools only.

I would suggest adding py-fixtures to the latter 3 ports manually if necessary.
Comment 2 Kai Knoblich freebsd_committer freebsd_triage 2018-06-21 22:55:00 UTC
Created attachment 194472 [details]
py-testtools_RUN_DEPENDS-v2.patch

Thank you for your insights and suggestions. The info about devel/py-fixtures that can be optionally used in conjunction with devel/py-testtools is very helpful and makes the situation a bit simpler.

Given those facts I assume that we still need to remove a line (= fixtures>=1.3.0) from the requirements.txt of the devel/py-testtools port to generate a requires.txt without devel/py-fixtures in it?

If you know a better way to cope with the requirements.txt I would be happy to hear about it.

Attached is a new patch which does following modifications:

for port devel/py-testtools:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- adds missing dependencies to RUN_DEPENDS (devel/py-pbr, devel/py-mimeparse, devel/py-unittest2, devel/py-six)
- adds LICENSE_FILE
- bumps PORTREVISION
- adds target post-patch to generate a requires.txt that has not the 'fixtures' package listed in it

for port devel/py-fixtures:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- adds devel/py-pbr to RUN_DEPENDS
- bumps PORTREVISION

for port devel/py-python-subunit:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- removes redundant entries from RUN_DEPENDS (devel/py-mimeparse + devel/py-unittest2)
- bumps PORTREVISION
- Note: my approval as maintainer for the change is given


QA:
~~~
- poudriere (11.1-RELEASE amd64 + i386) for each py27 + py36 flavor -> OK
- portlint -> OK
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-09-24 11:14:43 UTC
A commit references this bug:

Author: sunpoet
Date: Mon Sep 24 11:13:41 UTC 2018
New revision: 480591
URL: https://svnweb.freebsd.org/changeset/ports/480591

Log:
  Fix RUN_DEPENDS

  - Bump PORTREVISION for dependency change

  PR:		228769
  Submitted by:	Kai <freebsd_ports@k-worx.org>

Changes:
  head/devel/py-fixtures/Makefile
Comment 4 commit-hook freebsd_committer freebsd_triage 2018-09-24 11:14:45 UTC
A commit references this bug:

Author: sunpoet
Date: Mon Sep 24 11:13:46 UTC 2018
New revision: 480592
URL: https://svnweb.freebsd.org/changeset/ports/480592

Log:
  Fix RUN_DEPENDS

  - While I'm here, add TEST_DEPENDS
  - Bump PORTREVISION for dependency change

  PR:		228769
  Submitted by:	Kai <freebsd_ports@k-worx.org> (maintainer)

Changes:
  head/devel/py-python-subunit/Makefile
Comment 5 commit-hook freebsd_committer freebsd_triage 2018-09-24 11:14:47 UTC
A commit references this bug:

Author: sunpoet
Date: Mon Sep 24 11:14:13 UTC 2018
New revision: 480593
URL: https://svnweb.freebsd.org/changeset/ports/480593

Log:
  Fix RUN_DEPENDS

  - Add LICENSE_FILE
  - Bump PORTREVISION for dependency change

  PR:		228769
  Submitted by:	Kai <freebsd_ports@k-worx.org>

Changes:
  head/devel/py-testtools/Makefile
Comment 6 Po-Chuan Hsieh freebsd_committer freebsd_triage 2018-09-24 11:23:16 UTC
Committed. Thanks!