Bug 235301

Summary: devel/py-setuptools_scm: py27-setuptools_scm-3.1.0 fails to upgrade from py27-setuptools_scm-1.17.0
Product: Ports & Packages Reporter: Peter Putzer <freebsd>
Component: Individual Port(s)Assignee: Martin Wilke <miwi>
Status: Closed FIXED    
Severity: Affects Some People CC: aryeh.friedman, djohnson, kai, miwi, python, skh1002
Priority: --- Keywords: needs-qa
Version: LatestFlags: kai: maintainer-feedback+
koobs: merge-quarterly?
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
py-setuptools_scm-fix_inplace_upgrade.patch
kai: maintainer-approval+
py-setuptools_scm-fix_inplace_upgrade-NON-SVN.shar / for non-SVN users none

Description Peter Putzer 2019-01-29 17:54:51 UTC
An upgrade using postmaster on FreeBSD 11.2 fails with 

writing entry points to src/setuptools_scm.egg-info/entry_points.txt
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 116, in <module>
    setuptools.setup(**arguments)
  File "/usr/local/lib/python2.7/site-packages/setuptools/__init__.py", line 143, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/local/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python2.7/site-packages/setuptools/command/install.py", line 61, in run
    return orig.install.run(self)
  File "/usr/local/lib/python2.7/distutils/command/install.py", line 575, in run
    self.run_command(cmd_name)
  File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python2.7/site-packages/setuptools/command/install_egg_info.py", line 34, in run
    self.run_command('egg_info')
  File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 296, in run
    self.find_sources()
  File "/usr/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 303, in find_sources
    mm.run()
  File "/usr/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 534, in run
    self.add_defaults()
  File "/usr/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 573, in add_defaults
    rcfiles = list(walk_revctrl())
  File "/usr/local/lib/python2.7/site-packages/setuptools/command/sdist.py", line 20, in walk_revctrl
    for item in ep.load()(dirname):
  File "/usr/ports/devel/py-setuptools_scm/work-py27/setuptools_scm-3.1.0/src/setuptools_scm/integration.py", line 28, in find_files
    command = ep.load()
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2346, in load
    return self.resolve()
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2356, in resolve
    raise ImportError(str(exc))
ImportError: 'module' object has no attribute 'FILES_COMMAND'
*** Error code 1
Comment 1 Serge 2019-01-29 19:00:53 UTC
I confirm this happens as well when building under FreeBSD 12.0-RELEASE-p1.
Comment 2 Serge 2019-01-29 19:03:37 UTC
I forgot to say that I am using Python 3.7, but the error looks exactly the same.
Comment 3 Kai Knoblich freebsd_committer freebsd_triage 2019-01-29 22:41:42 UTC
(In reply to Peter Putzer from comment #0)
(In reply to Serge from comment #2)

Hello,

thank you for the info. I was able to reproduce the issue with portmaster and the following quick fix might remedy the problem by removing the the old version and then install the new version from the ports tree:

> # pkg remove -f py27-setuptools_scm
> # cd /usr/ports/devel/py-setuptools_scm
> # make install

I'll investigate this issue more thoroughly what's exactly causing this as soon as possible.
Comment 4 Kai Knoblich freebsd_committer freebsd_triage 2019-01-30 13:00:32 UTC
Created attachment 201529 [details]
py-setuptools_scm-fix_inplace_upgrade.patch
Comment 5 Kai Knoblich freebsd_committer freebsd_triage 2019-01-30 13:02:17 UTC
Created attachment 201530 [details]
py-setuptools_scm-fix_inplace_upgrade-NON-SVN.shar / for non-SVN users
Comment 6 Kai Knoblich freebsd_committer freebsd_triage 2019-01-30 13:22:50 UTC
I created two patches that should remedy the issue with the inplace upgrade of devel/py-setuptools_scm. The second patch, a shar file, is meant for the users that don't use SVN.

The root cause of the issue is that setup.py has been slightly changed since 3.0.0 . [1]

Before that there had been also a discussion [2] that led to the changes in the setup.py file [1].

[1] https://github.com/pypa/setuptools_scm/pull/264/commits/de0bed4fc96330b021cbee63dc4f3a5eae2549c5

[2] https://github.com/pypa/setuptools_scm/issues/262

@koobs: A quartely-merge is afaik not required because devel/py-setuptools_scm 3.1.0 has not been introduced to the quartely branch.
Comment 7 Martin Wilke freebsd_committer freebsd_triage 2019-01-30 16:32:28 UTC
*** Bug 235326 has been marked as a duplicate of this bug. ***
Comment 8 commit-hook freebsd_committer freebsd_triage 2019-01-30 16:40:08 UTC
A commit references this bug:

Author: miwi
Date: Wed Jan 30 16:39:38 UTC 2019
New revision: 491631
URL: https://svnweb.freebsd.org/changeset/ports/491631

Log:
  - Fix update with portmaster

  PR:		235301
  Submitted by:	Maintainer
  Reported by:	Many
  Sponsored by:	iXsystems Inc.

Changes:
  head/devel/py-setuptools_scm/files/
  head/devel/py-setuptools_scm/files/patch-setup.py