bin/python3 symlink for python3X ports

Дмитрий Сиваченко mitya at yandex-team.ru
Fri Oct 5 05:24:01 UTC 2012


On 01.10.2012 21:39, Li-Wen Hsu wrote:
>
> Thanks for working on this, I am looking forward to your patch.
>

Hello,

Please consider the attached patch for python2/python3 symlinks.
As I proposed earlier in this thread, I think it is sane to make these symlinks
for latest python2.X/python3.X versions only (this is what people should use by
default in most cases).

And let people explicitly run older versions if they really need them.
-------------- next part --------------
Index: python27/pkg-plist
===================================================================
--- python27/pkg-plist	(revision 305295)
+++ python27/pkg-plist	(working copy)
@@ -6,8 +6,10 @@
 %%IF_DEFAULT%%bin/pydoc
 bin/pydoc%%PYVER%%
 %%IF_DEFAULT%%bin/python
+bin/python%%PYMAJOR%%
 bin/python%%PYVER%%
 %%IF_DEFAULT%%bin/python-config
+bin/python%%PYMAJOR%%-config
 bin/python%%PYVER%%-config
 %%IF_DEFAULT%%bin/python-shared
 bin/python-shared%%PYVER%%
Index: python27/Makefile
===================================================================
--- python27/Makefile	(revision 305295)
+++ python27/Makefile	(working copy)
@@ -7,7 +7,7 @@
 
 PORTNAME=	python27
 PORTVERSION=	2.7.3
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	lang python ipv6
 MASTER_SITES=	${PYTHON_MASTER_SITES}
 MASTER_SITE_SUBDIR=	${PYTHON_MASTER_SITE_SUBDIR}
@@ -37,6 +37,7 @@
 PLIST=		${WRKDIR}/PLIST
 PLIST_TEMPLATE?=${PKGDIR}/pkg-plist
 PLIST_SUB=	PYVER=${PYTHON_VERSION:S/python//} \
+		PYMAJOR=${PYTHON_MAJOR_VER} \
 		PYVER_WITHPAT=${PORTVERSION:S/.c/c/}
 EXAMPLESDIR=	${PREFIX}/share/examples/${PYTHON_VERSION}
 DATADIR=	${PREFIX}/share/${PYTHON_VERSION}
@@ -287,6 +288,10 @@
 	done
 .endif
 
+.for file in python python-config
+	cd ${LOCALBASE}/bin && ${LN} -sf ${file:S/python/${PYTHON_VERSION}/} ${file:S/python/python${PYTHON_MAJOR_VER}/}
+.endfor
+
 .if !defined(NOPORTDATA)
 	@${MKDIR} ${DATADIR}
 	@cd ${PYTHON_WRKSRC}; ${TAR} -cf - Tools | \
Index: python32/pkg-plist
===================================================================
--- python32/pkg-plist	(revision 305295)
+++ python32/pkg-plist	(working copy)
@@ -5,8 +5,10 @@
 %%IF_DEFAULT%%bin/pydoc3
 bin/pydoc3-%%PYVER%%
 %%IF_DEFAULT%%bin/python
+bin/python%%PYMAJOR%%
 bin/python%%PYVER%%
 %%IF_DEFAULT%%bin/python-config
+bin/python%%PYMAJOR%%-config
 bin/python%%PYVER%%-config
 %%IF_DEFAULT%%bin/python-shared
 bin/python-shared%%PYVER%%
Index: python32/Makefile
===================================================================
--- python32/Makefile	(revision 305295)
+++ python32/Makefile	(working copy)
@@ -7,7 +7,7 @@
 
 PORTNAME=	python32
 PORTVERSION=	3.2.3
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	lang python ipv6
 MASTER_SITES=	${PYTHON_MASTER_SITES}
 MASTER_SITE_SUBDIR=	${PYTHON_MASTER_SITE_SUBDIR}
@@ -37,6 +37,7 @@
 
 SHARED_WRKSRC=	${PYTHON_WRKSRC}/portbld.shared
 PLIST_SUB=	PYVER=${PYTHON_VERSION:S/python//} \
+		PYMAJOR=${PYTHON_MAJOR_VER} \
 		PYVER_WITHPAT=${PORTVERSION:S/.rc/rc/} \
 		PYABIVER=${PYABIVER}
 EXAMPLESDIR=	${PREFIX}/share/examples/${PYTHON_VERSION}
@@ -216,6 +217,10 @@
 	done
 .endif
 
+.for file in python python-config
+	cd ${LOCALBASE}/bin && ${LN} -sf ${file:S/python/${PYTHON_VERSION}/} ${file:S/python/python${PYTHON_MAJOR_VER}/}
+.endfor
+
 .if !defined(NOPORTDATA)
 	@${MKDIR} ${DATADIR}
 	@cd ${PYTHON_WRKSRC}; ${TAR} -cf - Tools | \
-------------- next part --------------
--- bsd.python.mk.bak	2012-10-04 18:34:34.000000000 +0400
+++ bsd.python.mk	2012-10-05 09:10:17.000000000 +0400
@@ -87,6 +87,9 @@
 #					  in case you want to use an older version as a default.
 #					  default: python2.7
 #
+# PYTHON_MAJOR_VER	- Python version major number. 2 for python-2.x,
+#					  3 for python-3.x and so on.
+#
 # PYTHON_WRKSRC		- The ${WRKSRC} for your python version. Needed for
 #					  extensions like Tkinter, py-gdbm and py-expat, which
 #					  are built from sources contained in the Python
@@ -412,6 +415,8 @@
 	@${FALSE}
 .endif
 
+PYTHON_MAJOR_VER=	${PYTHON_VER:R}
+
 PYTHON_MASTER_SITES=		${MASTER_SITE_PYTHON}
 PYTHON_MASTER_SITE_SUBDIR=	ftp/python/${PYTHON_PORTVERSION:C/rc[0-9]//}
 PYTHON_DISTFILE=		Python-${PYTHON_PORTVERSION:S/.rc/rc/}${EXTRACT_SUFX}


More information about the freebsd-python mailing list