Bug 217447

Summary: textproc/py-sphinx: Fails with python:3.3+
Product: Ports & Packages Reporter: Danilo G. Baio <dbaio>
Component: Individual Port(s)Assignee: Kris Moore <kmoore>
Status: Closed FIXED    
Severity: Affects Some People CC: python, woodsb02
Priority: --- Flags: bugzilla: maintainer-feedback? (kmoore)
dbaio: exp-run?
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
py-sphinx-python3-error.patch none

Description Danilo G. Baio freebsd_committer freebsd_triage 2017-03-01 11:08:06 UTC
Created attachment 180389 [details]
py-sphinx-python3-error.patch

To reproduce it just set python 3.5 as default and execute a poudriere testport.
   DEFAULT_VERSIONS+=      python=3.5
   $ poudriere testport ... -o textproc/py-sphinx

>cd /wrkdirs/usr/ports/textproc/py3-sphinx/work/Sphinx-1.4.8/build/lib &&
>/usr/bin/env PYTHONPATH=/wrkdirs/usr/ports/textproc/py3-sphinx/work/Sphinx-1.4.8/build/lib:/usr/local/lib/python3.5/site-packages
>/usr/local/bin/python3.5 -m sphinx.pycode.pgen2.driver -c 'import load_grammar'
>/usr/local/lib/python3.5/runpy.py:125: RuntimeWarning: 'sphinx.pycode.pgen2.driver' found in
>sys.modules after import of package 'sphinx.pycode.pgen2', but prior to execution of
>'sphinx.pycode.pgen2.driver'; this may result in unpredictable behaviour
>  warn(RuntimeWarning(msg))

Removing post-build block fixes this.

This was introduced in ports r336515 version 1.2 and then on version 1.2.1
this caught my attention:

* #1152: Fix pycode parsing errors of Python 3 code by including two grammar
  versions for Python 2 and 3, and loading the appropriate version for the
running Python version.
https://github.com/sphinx-doc/sphinx/blob/master/CHANGES#L1687-L1689

I did some tests with this attached patch and couldn't find any problem, but
another eye on it will be great... and maybe an exprun...

Regards.
Comment 1 Danilo G. Baio freebsd_committer freebsd_triage 2017-03-01 11:15:15 UTC
This is the right log, the above is on a variant py3- that I am working for porting gitsome.

>cd /wrkdirs/usr/ports/textproc/py-sphinx/work/Sphinx-1.4.8/build/lib && 
>/usr/bin/env PYTHONPATH=/wrkdirs/usr/ports/textproc/py-sphinx/work/Sphinx-1.4.8/build/lib:/usr/local/lib/python3.5/site-packages 
>/usr/local/bin/python3.5 -m sphinx.pycode.pgen2.driver -c 'import load_grammar'
>/usr/local/lib/python3.5/runpy.py:125: RuntimeWarning: 'sphinx.pycode.pgen2.driver' found in sys.modules after import of package
>'sphinx.pycode.pgen2', but prior to execution of 'sphinx.pycode.pgen2.driver'; this may result in unpredictable behaviour
>  warn(RuntimeWarning(msg))
Comment 2 Kris Moore freebsd_committer freebsd_triage 2017-03-03 22:30:51 UTC
Thanks for sending this in! I'm testing this (And your other related py3 ports) now. Once it passes my internal poudriere runs, I'll get it committed.
Comment 3 Danilo G. Baio freebsd_committer freebsd_triage 2017-03-04 03:01:09 UTC
(In reply to Kris Moore from comment #2)

Thank you... If I can help in anything, let me know.
Regards.
Comment 4 Ben Woods freebsd_committer freebsd_triage 2017-06-08 14:12:07 UTC
Committed - thanks!
Comment 5 commit-hook freebsd_committer freebsd_triage 2017-06-08 14:12:48 UTC
A commit references this bug:

Author: woodsb02
Date: Thu Jun  8 14:11:44 UTC 2017
New revision: 442935
URL: https://svnweb.freebsd.org/changeset/ports/442935

Log:
  [NEW] textproc/py3-sphinx: Create Python 3.x version of this port

  Also make the following changes for the master textproc/py-sphinx port:
   - Remove post-build introduced when port was updated to version 1.2 in
     r336515, but is no longer required after version 1.2.1 [1].
   - Include upstream patch which fixes the bundling of grammar files [2]

  [1] https://github.com/sphinx-doc/sphinx/blob/1.2.1/CHANGES#L51-L53
  [2] https://github.com/sphinx-doc/sphinx/commit/b03b7e543f5e135d046d2fe407def219336c12b2

  PR:		217475
  PR:		217447
  PR:		219833
  Submitted by:	dbaio
  Approved by:	kmoore (maintainer timeout)

Changes:
  head/textproc/Makefile
  head/textproc/py-sphinx/Makefile
  head/textproc/py-sphinx/files/
  head/textproc/py-sphinx/files/patch-b03b7e543f5e135d046d2fe407def219336c12b2
  head/textproc/py3-sphinx/
  head/textproc/py3-sphinx/Makefile