summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Hupp <adam@hupp.org>2018-01-14 19:23:55 -0800
committerAdam Hupp <adam@hupp.org>2018-01-14 19:25:06 -0800
commit1622e2d384082f6d25a86ae9735e4a40b369ce7b (patch)
tree4933991147bd4f557b28e09d9f08ffb66f153aff
parent6143dcea61e41578976817ae4908cbc341655d44 (diff)
downloadpython-magic-1622e2d384082f6d25a86ae9735e4a40b369ce7b.tar.gz
various cleanups proposed by debian folks
-rw-r--r--README.md2
-rw-r--r--magic/__init__.py10
-rw-r--r--setup.py2
3 files changed, 9 insertions, 5 deletions
diff --git a/README.md b/README.md
index 710fef4..647c187 100644
--- a/README.md
+++ b/README.md
@@ -45,7 +45,7 @@ You can also combine the flag options:
Minor version bumps should be backwards compatible. Major bumps are not.
-## Compatability
+## Compatibility
There are, sadly, 3 libraries using the package name `magic`. The others are:
diff --git a/magic/__init__.py b/magic/__init__.py
index 3dfd422..d48f994 100644
--- a/magic/__init__.py
+++ b/magic/__init__.py
@@ -27,6 +27,8 @@ import logging
from ctypes import c_char_p, c_int, c_size_t, c_void_p
+# avoid shadowing the real open with the version from compat.py
+_real_open = open
class MagicException(Exception):
def __init__(self, message):
@@ -91,8 +93,7 @@ class Magic:
def from_file(self, filename):
# raise FileNotFoundException or IOError if the file does not exist
- # use __builtins__ because the compat stuff at the bottom shadows the builtin open
- with __builtins__['open'](filename):
+ with _real_open(filename):
pass
with self.lock:
@@ -337,7 +338,10 @@ def add_compat(to_module):
('detect_from_fobj', 'magic.Magic.from_open_file'),
('open', 'magic.Magic')]
for (fname, alternate) in fn:
- to_module[fname] = deprecation_wrapper(compat.__dict__, fname, alternate)
+ # for now, disable the deprecation warning until theres clarity on
+ # what the merged module should look like
+ to_module[fname] = compat.__dict__.get(fname)
+ #to_module[fname] = deprecation_wrapper(compat.__dict__, fname, alternate)
# copy constants over, ensuring there's no conflicts
is_const_re = re.compile("^[A-Z_]+$")
diff --git a/setup.py b/setup.py
index 03221fc..eebefb7 100644
--- a/setup.py
+++ b/setup.py
@@ -9,7 +9,7 @@ setup(name='python-magic',
author_email='adam@hupp.org',
url="http://github.com/ahupp/python-magic",
version='0.4.15',
- py_modules=['magic'],
+ packages=['magic'],
long_description="""This module uses ctypes to access the libmagic file type
identification library. It makes use of the local magic database and
supports both textual and MIME-type output.