Bug 229749 - lang/python36: python3.6-config breaks when symlinked e.g. by using BINARY_ALIAS in ports
Summary: lang/python36: python3.6-config breaks when symlinked e.g. by using BINARY_AL...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-python (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-13 09:18 UTC by Tobias Kortkamp
Modified: 2018-07-26 15:15 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (python)


Attachments
python36.diff (1.05 KB, patch)
2018-07-18 12:43 UTC, Tobias Kortkamp
tobik: maintainer-approval? (python)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Kortkamp freebsd_committer freebsd_triage 2018-07-13 09:18:39 UTC
When using BINARY_ALIAS together with python3.6-config, i.e.  symlinking
it to another location, it starts outputting bogus paths.

USES=		python:3.6+
BINARY_ALIAS=	python3-config=python${PYTHON_VER}-config

It is convenient to use when porting applications that hardcode use
of python3-config etc.

It works fine with python2.7-config.  However when I try a similar
thing with python3.6-config it starts outputting bogus paths.  For
example

$ pwd
/home/tobias
$ python2.7-config --includes
-I/usr/local/include/python2.7 -I/usr/local/include/python2.7
$ ln -s /usr/local/bin/python2.7-config python2-config
$ ./python2-config --includes
-I/usr/local/include/python2.7 -I/usr/local/include/python2.7
$ python3.6-config --includes
-I/usr/local/include/python3.6m -I/usr/local/include/python3.6m
$ ln -s /usr/local/bin/python3.6-config python3-config
$ ./python3-config --includes
-I/home/include/python3.6m -I/home/include/python3.6m

It would be nice if this could just work as it does with Python 2.7.
Comment 1 Antoine Brodin freebsd_committer freebsd_triage 2018-07-13 09:51:15 UTC
I noticed this too in ports r461704
Comment 2 Tobias Kortkamp freebsd_committer freebsd_triage 2018-07-18 12:43:54 UTC
Created attachment 195240 [details]
python36.diff

Here's a patch that maybe solves it.  I have also opened an upstream issue
here: https://bugs.python.org/issue34111

It's similar to the problem the LLVM wrapper scripts had (fixed in
ports r466018).
Comment 3 Martin Wilke freebsd_committer freebsd_triage 2018-07-23 05:03:05 UTC
Hi,

The patch looks good to me, @antoine shall we exp-run this patch?
Comment 4 Antoine Brodin freebsd_committer freebsd_triage 2018-07-24 08:50:55 UTC
This looks fine,  don't forget to bump PORTREVISION.
Comment 5 Martin Wilke freebsd_committer freebsd_triage 2018-07-24 19:45:31 UTC
(In reply to Antoine Brodin from comment #4)

Alright, thanks!

tobik@ feel free to commit this patch.
Comment 6 Tobias Kortkamp freebsd_committer freebsd_triage 2018-07-26 05:51:06 UTC
(In reply to Martin Wilke from comment #5)
Ok, thanks.  The other lang/python3? ports have the same problem.
Do I have approval to add the patch to them too?  It applies as is
to them.  It would be pointless to only add it to lang/python36.
Comment 7 Martin Wilke freebsd_committer freebsd_triage 2018-07-26 08:39:36 UTC
(In reply to Tobias Kortkamp from comment #6)
I agree. Please Proceed.
Comment 8 commit-hook freebsd_committer freebsd_triage 2018-07-26 08:59:29 UTC
A commit references this bug:

Author: tobik
Date: Thu Jul 26 08:58:52 UTC 2018
New revision: 475350
URL: https://svnweb.freebsd.org/changeset/ports/475350

Log:
  lang/python3?: Fix python3.?-config behavior when symlinked

  When python3.?-config is symlinked to another location it starts
  outputting bogus paths.  For example

  $ pwd
  /home/tobias
  $ python3.6-config --includes
  -I/usr/local/include/python3.6m -I/usr/local/include/python3.6m
  $ ln -s /usr/local/bin/python3.6-config python3-config
  $ ./python3-config --includes
  -I/home/include/python3.6m -I/home/include/python3.6m

  This breaks ports trying to use BINARY_ALIAS together with
  python3.?-config.  Apply a patch to resolve the symlink first before
  trying to find the install prefix.

  PR:		229749
  Submitted by:	tobik
  Reviewed by:	antoine, miwi
  Approved by:	python (miwi)

Changes:
  head/lang/python34/Makefile
  head/lang/python34/files/patch-Misc__python-config.sh.in
  head/lang/python35/Makefile
  head/lang/python35/files/patch-Misc__python-config.sh.in
  head/lang/python36/Makefile
  head/lang/python36/files/patch-Misc__python-config.sh.in
  head/lang/python37/Makefile
  head/lang/python37/files/patch-Misc__python-config.sh.in