Update 2020-05-06

Python 2.7.18 was officially added to the ports collection in r534040. I didn’t even bother searching for a PR on the matter, and sure enough, PR 245776 exists and did a more thorough job than my own efforts.


While Python 2.x.y is EoL, Python 2.7.18 was released a week ago, on 2020-04-20.

I noticed a discussion on the freebsd-ports mailling list, and the concensus is not to give any artificial life support to Python 2.x.y. My own opinion is to fix this error in Python 2.7.17, and spend the future converting the remaining ports to run happily with Python 3.x.y. I thought about submitting a PR, but I doubt it will be honoured. I don’t speak for the FreeBSD project, and vice versa.

My ports tree was at r533105, and I lock python, python2, and python3 to these versions in /etc/make.conf:

DEFAULT_VERSIONS+=python=3.7
DEFAULT_VERSIONS+=python2=2.7
DEFAULT_VERSIONS+=python3=3.7

Here’s what I did to get lang/python27 updated to 2.7.18. Use these instructions at your own risk.

pushd /usr/ports/lang/python27
# Edit Makefile.version
# Change 2.7.17 to 2.7.18, and save.
# Edit Makefile
# Delete the PORTREVISION line, and save.
pushd ../../distfiles/python
fetch https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz
fetch https://docs.python.org/2/archives/python-2.7.18-docs-pdf-letter.tar.bz2
fetch https://docs.python.org/2/archives/python-2.7.18-docs-pdf-a4.tar.bz2
fetch https://docs.python.org/2/archives/python-2.7.18-docs-html.tar.bz2
fetch https://docs.python.org/2/archives/python-2.7.18-docs-text.tar.bz2
fetch https://docs.python.org/ftp/python/doc/3.5.9/python-3.5.9-docs-pdf-letter.tar.bz2
fetch https://docs.python.org/ftp/python/doc/3.5.9/python-3.5.9-docs-pdf-a4.tar.bz2
fetch https://docs.python.org/ftp/python/doc/3.5.9/python-3.5.9-docs-html.tar.bz2
fetch https://docs.python.org/ftp/python/doc/3.5.9/python-3.5.9-docs-text.tar.bz2
fetch https://docs.python.org/3.8/archives/python-3.8.2-docs-pdf-letter.tar.bz2
fetch https://docs.python.org/3.8/archives/python-3.8.2-docs-pdf-a4.tar.bz2
fetch https://docs.python.org/3.8/archives/python-3.8.2-docs-html.tar.bz2
fetch https://docs.python.org/3.8/archives/python-3.8.2-docs-text.tar.bz2
popd
pushd ../python-doc-html
make makesum
# If make(1) throws any errors, you are probably missing a few files in /usr/ports/distfiles/python.
popd
make makesum
popd

You should end up with these changes to the ports tree:

Index: lang/python27/Makefile
===================================================================
--- lang/python27/Makefile      (revision 533105)
+++ lang/python27/Makefile      (working copy)
@@ -2,7 +2,6 @@

 PORTNAME=	python
 PORTVERSION=	${PYTHON_PORTVERSION}
-PORTREVISION=	1
 CATEGORIES=	lang python
 MASTER_SITES=	PYTHON/ftp/python/${PORTVERSION}
 PKGNAMESUFFIX=	27
Index: lang/python27/Makefile.version
===================================================================
--- lang/python27/Makefile.version      (revision 533105)
+++ lang/python27/Makefile.version      (working copy)
@@ -3,4 +3,4 @@

 # Do not forget to update python documentation (lang/python-doc-*)
 # Run "make -C lang/python-doc-html makesum"
-PYTHON_PORTVERSION=	2.7.17
+PYTHON_PORTVERSION=	2.7.18
Index: lang/python27/distinfo
===================================================================
--- lang/python27/distinfo      (revision 533105)
+++ lang/python27/distinfo      (working copy)
@@ -1,3 +1,3 @@
-TIMESTAMP = 1571538094
-SHA256 (python/Python-2.7.17.tar.xz) = 4d43f033cdbd0aa7b7023c81b0e986fd11e653b5248dac9144d508f11812ba41
-SIZE (python/Python-2.7.17.tar.xz) = 12855568
+TIMESTAMP = 1587992627
+SHA256 (python/Python-2.7.18.tar.xz) = b62c0e7937551d0cc02b8fd5cb0f544f9405bafc9a54d3808ed4594812edef43
+SIZE (python/Python-2.7.18.tar.xz) = 12854736
Index: lang/python-doc-html/distinfo
===================================================================
--- lang/python-doc-html/distinfo       (revision 533105)
+++ lang/python-doc-html/distinfo       (working copy)
@@ -1,12 +1,12 @@
-TIMESTAMP = 1584095619
-SHA256 (python/python-2.7.17-docs-html.tar.bz2) = d7388cfcf28591e5ab09932f70d180b1288130942779ead1fb40f750d72c18eb
-SIZE (python/python-2.7.17-docs-html.tar.bz2) = 4605137
-SHA256 (python/python-2.7.17-docs-pdf-a4.tar.bz2) = b4e09d093f03dd879ad207a9043212d6adb9a40e90540f1526315c361faf2219
-SIZE (python/python-2.7.17-docs-pdf-a4.tar.bz2) = 11441433
-SHA256 (python/python-2.7.17-docs-pdf-letter.tar.bz2) = 9fe275a4a318dfd260b5439afd0fe85ffbcefeacdb93815f2565c3f9faef1c6e
-SIZE (python/python-2.7.17-docs-pdf-letter.tar.bz2) = 11440298
-SHA256 (python/python-2.7.17-docs-text.tar.bz2) = ee7c3678718870ab76f3b7d2269f79ba9e84c91788a1ce8fc4b13b7401c9891a
-SIZE (python/python-2.7.17-docs-text.tar.bz2) = 1630849
+TIMESTAMP = 1587993867
+SHA256 (python/python-2.7.18-docs-html.tar.bz2) = 059aef93ce9982609834773a4680ce228978fa901aa9877f012bf538b1f55256
+SIZE (python/python-2.7.18-docs-html.tar.bz2) = 4732655
+SHA256 (python/python-2.7.18-docs-pdf-a4.tar.bz2) = 0a080b7be1234c60c1a88647b3cbe2a6f262a3dc025f2c8b2449c99a3fbc9c25
+SIZE (python/python-2.7.18-docs-pdf-a4.tar.bz2) = 11456256
+SHA256 (python/python-2.7.18-docs-pdf-letter.tar.bz2) = 78a129b6a5117684fea4fae4ebe677e0dd26d3fa290ce367c9250b7b8aa5d9f6
+SIZE (python/python-2.7.18-docs-pdf-letter.tar.bz2) = 11455415
+SHA256 (python/python-2.7.18-docs-text.tar.bz2) = c2396b36632ecdefa3fbf9f73c80641c315e8d4a515da5e6616f4450e0ca74ff
+SIZE (python/python-2.7.18-docs-text.tar.bz2) = 1633624
 SHA256 (python/python-3.5.9-docs-html.tar.bz2) = b0cfe724c612b563da7e5fceb7b4b70eedd40b2f01b04d199a073090f0908b9f
 SIZE (python/python-3.5.9-docs-html.tar.bz2) = 5780603
 SHA256 (python/python-3.5.9-docs-pdf-a4.tar.bz2) = c8fa8c4f0f313569d3893d9ff9c7fed6564d4d4e961c4f796ee870c1f9e59d75
@@ -31,11 +31,11 @@
 SIZE (python/python-3.7.7-docs-pdf-letter.tar.bz2) = 14289660
 SHA256 (python/python-3.7.7-docs-text.tar.bz2) = 26231081c1214e2ab1af1001607bafb25ee10ef8671e7f5722782f63e9415bd8
 SIZE (python/python-3.7.7-docs-text.tar.bz2) = 2288271
-SHA256 (python/python-3.8.2-docs-html.tar.bz2) = e12135b29ef231fce0d20c5865cf7fb37cecea11f2304e389325b04e9281558a
-SIZE (python/python-3.8.2-docs-html.tar.bz2) = 6536475
-SHA256 (python/python-3.8.2-docs-pdf-a4.tar.bz2) = 9cf8ac9960c5db0594c7c9d9cee33d31fa8619277c496a257e434f9887b8053e
-SIZE (python/python-3.8.2-docs-pdf-a4.tar.bz2) = 14635317
-SHA256 (python/python-3.8.2-docs-pdf-letter.tar.bz2) = c37cb6bd119f76b717d27f205156405638df0299814d9566f943dcdd25cdd5b2
-SIZE (python/python-3.8.2-docs-pdf-letter.tar.bz2) = 14740766
-SHA256 (python/python-3.8.2-docs-text.tar.bz2) = c80ffdbc76af13327344e7ef0c1da3ac04c6f77cf1bb3bc6886b2e4dbf39f729
-SIZE (python/python-3.8.2-docs-text.tar.bz2) = 2399195
+SHA256 (python/python-3.8.2-docs-html.tar.bz2) = 924b171b3d2cee7da8abc7ae7fa61bceb2b99789535c1151b948a5a428b98817
+SIZE (python/python-3.8.2-docs-html.tar.bz2) = 6612278
+SHA256 (python/python-3.8.2-docs-pdf-a4.tar.bz2) = 2e2a656e23bc1a980aa12e443b676eb56c0846eb6d34b7d3449caa64f8f69b76
+SIZE (python/python-3.8.2-docs-pdf-a4.tar.bz2) = 14670763
+SHA256 (python/python-3.8.2-docs-pdf-letter.tar.bz2) = e40e8a562064c9b87e2108ec452297068c1559c7ca55551312e14804bcb45635
+SIZE (python/python-3.8.2-docs-pdf-letter.tar.bz2) = 14785254
+SHA256 (python/python-3.8.2-docs-text.tar.bz2) = b24182e25b47bb088eed0eda51c3f98368adf623e7768a1b3c9ed2f38a2726bd
+SIZE (python/python-3.8.2-docs-text.tar.bz2) = 2407193

The TIMESTAMP lines will be different since you will have run the make makesum commands at a later time.

I then let ports-mgmt/synth do its magic, recompiling all affected ports, 37 in total. Only the lang/python27 package got upgraded:

Apr 27 16:08:26 <user.notice> HOSTNAME pkg[43889]: python27 upgraded: 2.7.17_1 -> 2.7.18

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>