diff --git a/py36.patch b/py36.patch new file mode 100644 index 0000000..4da9988 --- /dev/null +++ b/py36.patch @@ -0,0 +1,59 @@ +diff -ur Pmw/Pmw_2_0_1.orig/bin/bundlepmw.py Pmw/Pmw_2_0_1/bin/bundlepmw.py +--- Pmw/Pmw_2_0_1.orig/bin/bundlepmw.py 2012-08-04 00:56:51.000000000 +0000 ++++ Pmw/Pmw_2_0_1/bin/bundlepmw.py 2017-05-07 19:57:25.954264305 +0000 +@@ -11,7 +11,6 @@ + + import os + import re +-import string + import sys + + # The order of these files is significant. Files which reference +@@ -66,7 +65,7 @@ + dir = expandLinks(dir) + dir = os.path.basename(dir) + +-version = string.replace(dir[4:], '_', '.') ++version = dir[4:].replace('_', '.') + + # Code to import the Color module. + colorCode = """ +@@ -147,7 +146,8 @@ + + # Specially handle PmwBase.py file: + text = mungeFile('Base') +-text = re.sub('import PmwLogicalFont', '', text) ++text = re.sub('from . import PmwBlt', 'PmwBlt = Blt', text) ++text = re.sub('from . import PmwLogicalFont', '', text) + text = re.sub('PmwLogicalFont._font_initialise', '_font_initialise', text) + outfile.write(text) + if not needBlt: +diff -ur Pmw/Pmw_2_0_1.orig/lib/PmwColor.py Pmw/Pmw_2_0_1/lib/PmwColor.py +--- Pmw/Pmw_2_0_1.orig/lib/PmwColor.py 2013-02-26 13:01:23.000000000 +0000 ++++ Pmw/Pmw_2_0_1/lib/PmwColor.py 2017-05-07 19:59:51.116891121 +0000 +@@ -10,7 +10,7 @@ + _TWO_PI = _PI * 2 + _THIRD_PI = _PI / 3 + _SIXTH_PI = _PI / 6 +-_MAX_RGB = float(256 * 256 - 1) # max size of rgb values returned from Tk ++_MAX_RGB = 256 * 256 - 1 # max size of rgb values returned from Tk + + def setscheme(root, background=None, **kw): + root = root._root() +@@ -346,13 +346,13 @@ + lightRGB = [] + darkRGB = [] + for value in name2rgb(root, colorName, 1): +- value40pc = (14 * value) / 10 ++ value40pc = (14 * value) // 10 + if value40pc > _MAX_RGB: + value40pc = _MAX_RGB +- valueHalfWhite = (_MAX_RGB + value) / 2; ++ valueHalfWhite = (_MAX_RGB + value) // 2; + lightRGB.append(max(value40pc, valueHalfWhite)) + +- darkValue = (60 * value) / 100 ++ darkValue = (60 * value) // 100 + darkRGB.append(darkValue) + + return ( diff --git a/python-pmw.changes b/python-pmw.changes index 0e43d44..e240075 100644 --- a/python-pmw.changes +++ b/python-pmw.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sun May 7 20:06:55 UTC 2017 - dhall@wustl.edu + +- add patch for python3.6 + * https://sourceforge.net/p/pmw/patches/7/ + ------------------------------------------------------------------- Sat May 6 23:47:52 UTC 2017 - dhall@wustl.edu diff --git a/python-pmw.spec b/python-pmw.spec index 9130c35..60b15a8 100644 --- a/python-pmw.spec +++ b/python-pmw.spec @@ -25,6 +25,8 @@ Url: http://pmw.sourceforge.net/ Summary: High-level compound widgets in Python using the Tkinter module License: MIT Group: Development/Languages/Python +# py36.patch Patch to work with python 3.6 https://sourceforge.net/p/pmw/patches/7/ +Patch: py36.patch Source: https://pypi.python.org/packages/e7/20/8d0c4ba96a5fe62e1bcf2b8a212ccfecd67ad951e8f3e89cf147d63952aa/Pmw-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: %{python_module base} @@ -43,6 +45,7 @@ dialog windows. %prep %setup -q -n Pmw-%{version} +%patch sed -i '1d' Pmw/Pmw_1_3_3/{demos/All,bin/bundlepmw,tests/All,tests/ManualTests}.py # Fix non-executable scripts sed -i '1d' Pmw/Pmw_2_0_1/{demos/All,bin/bundlepmw,tests/All,tests/ManualTests}.py # Fix non-executable scripts