pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

subliminal: port to Python 3



Module Name:	pkgsrc-wip
Committed By:	Leonardo Taccari <leot%NetBSD.org@localhost>
Pushed By:	leot
Date:		Mon Feb 13 17:10:33 2017 +0100
Changeset:	70bf6e44acd2bd94e70cb92b4100c021343068e8

Modified Files:
	subliminal/Makefile
	subliminal/PLIST
	subliminal/distinfo
Added Files:
	subliminal/ALTERNATIVES
	subliminal/patches/patch-subliminal_subtitles_____init____.py
	subliminal/patches/patch-subliminal_subtitles_subrip.py
Removed Files:
	subliminal/TODO

Log Message:
subliminal: port to Python 3

- Fix print() usage via __future__.print_function in order to make it works
  with Python 3 too (lesson learned: always pay attention also to the
  byte-compilation messages because they can explain the "why" part of PLIST
  mismatches!)
- Get rid of TODO (now that it is finally done!)
- Add ALTERNATIVES and install the subliminal script suffixed with
  -${PYVERSSUFFIX}

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=70bf6e44acd2bd94e70cb92b4100c021343068e8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 subliminal/ALTERNATIVES                            |  1 +
 subliminal/Makefile                                |  3 +++
 subliminal/PLIST                                   |  2 +-
 subliminal/TODO                                    |  8 -------
 subliminal/distinfo                                |  2 ++
 .../patch-subliminal_subtitles_____init____.py     | 19 +++++++++++++++
 .../patches/patch-subliminal_subtitles_subrip.py   | 27 ++++++++++++++++++++++
 7 files changed, 53 insertions(+), 9 deletions(-)

diffs:
diff --git a/subliminal/ALTERNATIVES b/subliminal/ALTERNATIVES
new file mode 100644
index 0000000000..30e992b532
--- /dev/null
+++ b/subliminal/ALTERNATIVES
@@ -0,0 +1 @@
+bin/subliminal @PREFIX@/bin/subliminal-@PYVERSSUFFIX@
diff --git a/subliminal/Makefile b/subliminal/Makefile
index 2b223c031e..3b9b390b68 100644
--- a/subliminal/Makefile
+++ b/subliminal/Makefile
@@ -32,5 +32,8 @@ DEPENDS+=	${PYPKGPREFIX}-futures>=3.0:../../devel/py-futures
 
 USE_LANGUAGES=	# none
 
+post-install:
+	${MV} ${DESTDIR}${PREFIX}/bin/subliminal ${DESTDIR}${PREFIX}/bin/subliminal-${PYVERSSUFFIX} || ${TRUE}
+
 .include "../../lang/python/application.mk"
 .include "../../mk/bsd.pkg.mk"
diff --git a/subliminal/PLIST b/subliminal/PLIST
index fc3f034ae7..b40ffea756 100644
--- a/subliminal/PLIST
+++ b/subliminal/PLIST
@@ -1,5 +1,5 @@
 @comment $NetBSD$
-bin/subliminal
+bin/subliminal-${PYVERSSUFFIX}
 ${PYSITELIB}/${EGG_INFODIR}/PKG-INFO
 ${PYSITELIB}/${EGG_INFODIR}/SOURCES.txt
 ${PYSITELIB}/${EGG_INFODIR}/dependency_links.txt
diff --git a/subliminal/TODO b/subliminal/TODO
deleted file mode 100644
index a8eb71502a..0000000000
--- a/subliminal/TODO
+++ /dev/null
@@ -1,8 +0,0 @@
-- Investigate PLIST issues for python36.
-  Two extra files installed if subliminal is built with python27 (but missing if
-  it is built with python36):
-
-  .../.destdir/usr/pkg/lib/python3.6/site-packages/subliminal/subtitles/__pycache__/__init__.cpython-36.opt-1.pyc
-  .../.destdir/usr/pkg/lib/python3.6/site-packages/subliminal/subtitles/__pycache__/__init__.cpython-36.pyc
-
-- Add an ALTERNATIVES file (maybe?).
diff --git a/subliminal/distinfo b/subliminal/distinfo
index 29d8cb1763..5a716a22c4 100644
--- a/subliminal/distinfo
+++ b/subliminal/distinfo
@@ -4,3 +4,5 @@ SHA1 (subliminal-2.0.5.tar.gz) = a74f7be06afda4ce53563a13ce7d685fa4f1148f
 RMD160 (subliminal-2.0.5.tar.gz) = 0e9426ac4681cdf0e8a8f7742f4fada2f228d91c
 SHA512 (subliminal-2.0.5.tar.gz) = 56bc0e87496d5bc361430c4ee396b20374da697014203bdc4dda12341918e67c98aec579e44bd467898dbbf11f31e9de47ece17a0d78339f2bc700e3e6c8dd40
 Size (subliminal-2.0.5.tar.gz) = 51247 bytes
+SHA1 (patch-subliminal_subtitles_____init____.py) = 253b44d1421f51bc91abdbf960dbf759517e3f28
+SHA1 (patch-subliminal_subtitles_subrip.py) = f1ee205dce7cc566377d0a43b80974c7ef2432d8
diff --git a/subliminal/patches/patch-subliminal_subtitles_____init____.py b/subliminal/patches/patch-subliminal_subtitles_____init____.py
new file mode 100644
index 0000000000..7d0e8969c2
--- /dev/null
+++ b/subliminal/patches/patch-subliminal_subtitles_____init____.py
@@ -0,0 +1,19 @@
+$NetBSD$
+
+Use print() function from the __future__ in order to make the code compatible
+with Python 3.
+
+--- subliminal/subtitles/__init__.py.orig	2016-05-01 17:44:42.000000000 +0000
++++ subliminal/subtitles/__init__.py
+@@ -1,4 +1,5 @@
+ # -*- coding: utf-8 -*-
++from __future__ import print_function
+ from datetime import time
+ 
+ 
+@@ -85,4 +86,4 @@ class Cue(object):
+ 
+ if __name__ == '__main__':
+     cue = Cue(time(), time(1), [Bold('Hello')])
+-    print repr(cue)
++    print(repr(cue))
diff --git a/subliminal/patches/patch-subliminal_subtitles_subrip.py b/subliminal/patches/patch-subliminal_subtitles_subrip.py
new file mode 100644
index 0000000000..c7f8f7f84e
--- /dev/null
+++ b/subliminal/patches/patch-subliminal_subtitles_subrip.py
@@ -0,0 +1,27 @@
+$NetBSD$
+
+Use print() function from the __future__ in order to make the code compatible
+with Python 3.
+
+--- subliminal/subtitles/subrip.py.orig	2016-06-24 19:30:34.000000000 +0000
++++ subliminal/subtitles/subrip.py
+@@ -1,5 +1,6 @@
+ # -*- coding: utf-8 -*-
+ import re
++from __future__ import print_function
+ from datetime import time
+ 
+ from subliminal.subtitles import Cue
+@@ -73,10 +74,10 @@ class SubripSubtitle(object):
+ 
+ 
+ if __name__ == '__main__':
+-    print read_cue('toto')
++    print(read_cue('toto'))
+       i = 0
+     for x in read_cue('toto'):
+-        print x
++        print(x)
+         if i > 10:
+             break
+         i += 1


Home | Main Index | Thread Index | Old Index