Skip to content

Commit d09d843

Browse files
committed
Remove dependency on the external meld3 package
1 parent dbff619 commit d09d843

File tree

12 files changed

+3197
-24
lines changed

12 files changed

+3197
-24
lines changed

CHANGES.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
4.0.5.dev0 (Next Release)
1+
4.1.0.dev0 (Next Release)
22
-------------------------
33

44
- Fixed a Python 3.8 compatibility issue caused by the removal of
55
``cgi.escape()``. Patch by Mattia Procopio.
66

7+
- The ``meld3`` package is no longer a dependency. A version of ``meld3``
8+
is now included within the ``supervisor`` package itself.
9+
710
4.0.4 (2019-07-15)
811
------------------
912

docs/installing.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ which is internet-connected:
5454
- setuptools (latest) from `https://pypi.org/pypi/setuptools/
5555
<https://pypi.org/pypi/setuptools/>`_.
5656

57-
- meld3 (latest) from `https://pypi.org/pypi/meld3/
58-
<https://pypi.org/pypi/meld3/>`_.
59-
6057
Copy these files to removable media and put them on the target
6158
machine. Install each onto the target machine as per its
6259
instructions. This typically just means unpacking each file and

setup.cfg

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
[easy_install]
22
zip_ok = false
33

4-
[bdist_rpm]
5-
;If you are building your own RPM of Supervisor, it is recommended that you
6-
;also build your own RPM of meld3 (https://github.com/Supervisor/meld3) to
7-
;ensure you have the most recent version. Your distribution may have a
8-
;"python-meld3" package that you might be able substitute here, but it may
9-
;not be compatible and may not have the most recent bug fixes.
10-
requires =
11-
meld3
12-
134
[aliases]
145
dev = develop easy_install supervisor[testing]
156

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
elif (3, 0) < py_version < (3, 4):
2323
raise RuntimeError('On Python 3, Supervisor requires Python 3.4 or later')
2424

25-
requires = ['meld3 >= 1.0.0']
25+
requires = []
2626
tests_require = []
2727
if py_version < (3, 3):
2828
tests_require.append('mock')

supervisor/compat.py

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,20 @@
88
long = long
99
raw_input = raw_input
1010
unicode = unicode
11+
unichr = unichr
1112
basestring = basestring
12-
def as_bytes(s): return s if isinstance(s, str) else s.encode('utf-8')
13-
def as_string(s): return s if isinstance(s, unicode) else s.decode('utf-8')
13+
14+
def as_bytes(s, encoding='utf-8'):
15+
if isinstance(s, str):
16+
return s
17+
else:
18+
return s.encode(encoding)
19+
20+
def as_string(s, encoding='utf-8'):
21+
if isinstance(s, unicode):
22+
return s
23+
else:
24+
return s.decode(encoding)
1425

1526
def is_text_stream(stream):
1627
try:
@@ -25,15 +36,28 @@ def is_text_stream(stream):
2536
except ImportError:
2637
import io
2738
return isinstance(stream, io.TextIOWrapper)
39+
2840
else: # pragma: no cover
2941
long = int
3042
basestring = str
3143
raw_input = input
44+
unichr = chr
45+
3246
class unicode(str):
3347
def __init__(self, string, encoding, errors):
3448
str.__init__(self, string)
35-
def as_bytes(s): return s if isinstance(s,bytes) else s.encode('utf8')
36-
def as_string(s): return s if isinstance(s,str) else s.decode('utf8')
49+
50+
def as_bytes(s, encoding='utf8'):
51+
if isinstance(s, bytes):
52+
return s
53+
else:
54+
return s.encode(encoding)
55+
56+
def as_string(s, encoding='utf8'):
57+
if isinstance(s, str):
58+
return s
59+
else:
60+
return s.decode(encoding)
3761

3862
def is_text_stream(stream):
3963
import _io
@@ -106,7 +130,22 @@ def is_text_stream(stream):
106130
except ImportError: # pragma: no cover
107131
import _thread as thread
108132

133+
try: # pragma: no cover
134+
from types import StringTypes
135+
except ImportError: # pragma: no cover
136+
StringTypes = (str,)
137+
109138
try: # pragma: no cover
110139
from html import escape
111140
except ImportError: # pragma: no cover
112141
from cgi import escape
142+
143+
try: # pragma: no cover
144+
import html.entities as htmlentitydefs
145+
except ImportError: # pragma: no cover
146+
import htmlentitydefs
147+
148+
try: # pragma: no cover
149+
from html.parser import HTMLParser
150+
except ImportError: # pragma: no cover
151+
from HTMLParser import HTMLParser

0 commit comments

Comments
 (0)