Skip to content

Commit 0f7e3c9

Browse files
committed
Bump major version to drop Python2 support.
If any project still needs a Python2 compatible yapsy, they must add the <2 constraints in their yapsy requirements. The other main breaking change here is to drop the compat.py file and its global variables.
1 parent 49fa2b8 commit 0f7e3c9

15 files changed

+20
-117
lines changed

.travis.yml

-17
This file was deleted.

package/CHANGELOG.txt

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
version-2.0.0 [????]
2+
- code: Python2 support is dropped, compat.py and its variables are gone.
3+
14
version-1.12.0 [2018-09-02]
25
- code: fix yapsy on python3.6
36
- code: Make the test more robust to "unusual" unpacking of the module (see: https://sourceforge.net/p/yapsy/bugs/32/)

package/LICENSE.txt

-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ with the following two exceptions:
55
Attribution-Share Alike 3.0 by Thibauld Nion (see
66
artwork/LICENSE.txt)
77

8-
- the compat.py file is licensed under the ISC License by Kenneth
9-
Reitz (see yapsy/compat.py).
10-
118

129
--------------------
1310
BSD 2-clause license

package/setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
'License :: OSI Approved :: BSD License',
6060
'Operating System :: OS Independent',
6161
'Programming Language :: Python',
62-
'Programming Language :: Python :: 2',
6362
'Programming Language :: Python :: 3',
6463
'Topic :: Software Development :: Libraries :: Python Modules'],
6564
platforms='All',

package/test/test_ConfigPlugin.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os
66
import unittest
77

8-
from yapsy.compat import ConfigParser
8+
from configparser import ConfigParser
99
from yapsy.ConfigurablePluginManager import ConfigurablePluginManager
1010

1111

package/test/test_PluginFileLocator.py

+3-13
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import unittest
55
import sys
66
import os
7-
from yapsy.compat import ConfigParser, StringIO, str, builtin_str
7+
from configparser import ConfigParser
8+
from io import StringIO
89
import tempfile
910
import shutil
1011

@@ -77,18 +78,7 @@ def test_isValid_WithMultiExtensions(self):
7778
self.assertFalse(analyzer.isValidPlugin(self.version_plugin_path))
7879
self.assertTrue(analyzer.isValidPlugin(self.yapsy_filter_plugin_path))
7980

80-
def test__extractCorePluginInfo_with_builtin_str_filename(self):
81-
plugin_desc_content = builtin_str("simpleplugin.yapsy-plugin")
82-
analyzer = PluginFileAnalyzerWithInfoFile("mouf", ("yapsy-plugin"))
83-
infos, parser = analyzer._extractCorePluginInfo(self.plugin_directory,
84-
plugin_desc_content)
85-
self.assertEqual("Simple Plugin", infos["name"])
86-
self.assertEqual(os.path.join(self.plugin_directory, "SimplePlugin"), infos["path"])
87-
88-
def test__extractCorePluginInfo_with_unicode_filename(self):
89-
"""Note: this test is redundant with its 'builtin_str' counterpart on Python3
90-
but not on Python2"""
91-
# Note: compat.py redefines str as unicode for Python2
81+
def test__extractCorePluginInfo_with_str_filename(self):
9282
plugin_desc_content = str("simpleplugin.yapsy-plugin")
9383
analyzer = PluginFileAnalyzerWithInfoFile("mouf", ("yapsy-plugin"))
9484
infos, parser = analyzer._extractCorePluginInfo(self.plugin_directory,

package/test/test_PluginInfo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t; python-indent: 4 -*-
22

33
import test_settings
4-
from yapsy.compat import ConfigParser
4+
from configparser import ConfigParser
55
import unittest
66

77

package/test/test_SimplePlugin.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from yapsy.PluginFileLocator import PluginFileLocator
1010
from yapsy.PluginFileLocator import IPluginFileAnalyzer
1111
from yapsy import NormalizePluginNameForModuleName
12-
from yapsy.compat import ConfigParser
12+
from configparser import ConfigParser
1313

1414
class YapsyUtils(unittest.TestCase):
1515

package/test/test_Singleton.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from yapsy.ConfigurablePluginManager import ConfigurablePluginManager
99
from yapsy.VersionedPluginManager import VersionedPluginManager
1010
from yapsy.PluginManager import PluginManagerSingleton
11-
from yapsy.compat import ConfigParser
11+
from configparser import ConfigParser
1212

1313

1414
"""

package/yapsy/AutoInstallPluginManager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from yapsy.IPlugin import IPlugin
2020
from yapsy.PluginManagerDecorator import PluginManagerDecorator
2121
from yapsy import log
22-
from yapsy.compat import StringIO, str
22+
from io import StringIO
2323

2424

2525
class AutoInstallPluginManager(PluginManagerDecorator):

package/yapsy/PluginFileLocator.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,16 @@
5555

5656
import os
5757
import re
58+
from configparser import ConfigParser
59+
5860
from yapsy import log
59-
from yapsy.compat import ConfigParser, is_py2, basestring
6061

6162
from yapsy.PluginInfo import PluginInfo
6263
from yapsy import PLUGIN_NAME_FORBIDEN_STRING
6364
from yapsy.IPluginLocator import IPluginLocator
6465

6566

67+
_BASIC_STRING_CLASSES = (str, bytes)
6668

6769

6870
class IPluginFileAnalyzer(object):
@@ -180,10 +182,7 @@ def getPluginNameAndModuleFromStream(self, infoFileObject, candidate_infofile=No
180182
# parse the information buffer to get info about the plugin
181183
config_parser = ConfigParser()
182184
try:
183-
if is_py2:
184-
config_parser.readfp(infoFileObject)
185-
else:
186-
config_parser.read_file(infoFileObject)
185+
config_parser.read_file(infoFileObject)
187186
except Exception as e:
188187
log.debug("Could not parse the plugin file '%s' (exception raised was '%s')" % (candidate_infofile,e))
189188
return (None, None, None)
@@ -216,7 +215,7 @@ def _extractCorePluginInfo(self,directory, filename):
216215
and decorators.
217216
"""
218217
# now we can consider the file as a serious candidate
219-
if not isinstance(filename, basestring):
218+
if not isinstance(filename, _BASIC_STRING_CLASSES):
220219
# filename is a file object: use it
221220
name, moduleName, config_parser = self.getPluginNameAndModuleFromStream(filename)
222221
else:
@@ -514,7 +513,7 @@ def setPluginPlaces(self, directories_list):
514513
"""
515514
Set the list of directories where to look for plugin places.
516515
"""
517-
if isinstance(directories_list, basestring):
516+
if isinstance(directories_list, _BASIC_STRING_CLASSES):
518517
raise ValueError("'directories_list' given as a string, but expected to be a list or enumeration of strings")
519518
if directories_list is None:
520519
directories_list = [os.path.dirname(__file__)]

package/yapsy/PluginInfo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
===
1212
"""
1313

14-
from yapsy.compat import ConfigParser
14+
from configparser import ConfigParser
1515
from distutils.version import StrictVersion
1616

1717

package/yapsy/__init__.py

+2-11
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
5353
"""
5454

55-
__version__="1.12.2"
55+
__version__="2.0.0"
5656

5757
# tell epydoc that the documentation is in the reStructuredText format
5858
__docformat__ = "restructuredtext en"
@@ -70,12 +70,7 @@
7070
"""
7171

7272
import re
73-
from yapsy.compat import is_py2, str
74-
75-
if is_py2:
76-
RE_NON_ALPHANUM = re.compile("\W", re.U)
77-
else:
78-
RE_NON_ALPHANUM = re.compile("\W")
73+
RE_NON_ALPHANUM = re.compile("\W")
7974

8075

8176
def NormalizePluginNameForModuleName(pluginName):
@@ -85,13 +80,9 @@ def NormalizePluginNameForModuleName(pluginName):
8580
.. note:: may do a little more modifications than strictly
8681
necessary and is not optimized for speed.
8782
"""
88-
if is_py2:
89-
pluginName = str(pluginName, 'utf-8')
9083
if len(pluginName)==0:
9184
return "_"
9285
if pluginName[0].isdigit():
9386
pluginName = "_" + pluginName
9487
ret = RE_NON_ALPHANUM.sub("_",pluginName)
95-
if is_py2:
96-
ret = ret.encode('utf-8')
9788
return ret

package/yapsy/compat.py

-58
This file was deleted.

utils/upload_packages.sh

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ activate_release_env
1010
# Generate package
1111
rm -r $PACKAGE_DIR/build
1212
rm -r $PACKAGE_DIR/dist
13-
python $PACKAGE_DIR/setup.py sdist bdist_egg
1413
python3 $PACKAGE_DIR/setup.py bdist_egg
1514

1615
# Upload the package

0 commit comments

Comments
 (0)