102 lines
3.1 KiB
Diff
102 lines
3.1 KiB
Diff
|
From a89d94641c8f926a007c217fcbb26149f9fe4570 Mon Sep 17 00:00:00 2001
|
||
|
From: Carl George <carl@george.computer>
|
||
|
Date: Thu, 25 Aug 2022 13:27:43 -0500
|
||
|
Subject: [PATCH] Use system mimeparse
|
||
|
|
||
|
This modifies imports to use the system mimeparse instead of the
|
||
|
vendored one and adds a requirement on python-mimeparse. It also
|
||
|
reverts a test change to check the vendored mimeparse instead of an
|
||
|
external mimeparse.
|
||
|
|
||
|
Reverts f19039aaa1b435a174d4f041fb0728238c79d254
|
||
|
---
|
||
|
falcon/media/handlers.py | 2 +-
|
||
|
falcon/request.py | 2 +-
|
||
|
setup.cfg | 1 +
|
||
|
setup.py | 1 -
|
||
|
tests/test_deps.py | 15 ++++++++-------
|
||
|
5 files changed, 11 insertions(+), 10 deletions(-)
|
||
|
|
||
|
diff --git a/falcon/media/handlers.py b/falcon/media/handlers.py
|
||
|
index bd3898d..38b8f9c 100644
|
||
|
--- a/falcon/media/handlers.py
|
||
|
+++ b/falcon/media/handlers.py
|
||
|
@@ -12,7 +12,7 @@ from falcon.media.multipart import MultipartParseOptions
|
||
|
from falcon.media.urlencoded import URLEncodedFormHandler
|
||
|
from falcon.util import deprecation
|
||
|
from falcon.util import misc
|
||
|
-from falcon.vendor import mimeparse
|
||
|
+import mimeparse
|
||
|
|
||
|
|
||
|
class MissingDependencyHandler:
|
||
|
diff --git a/falcon/request.py b/falcon/request.py
|
||
|
index 410d550..701ed56 100644
|
||
|
--- a/falcon/request.py
|
||
|
+++ b/falcon/request.py
|
||
|
@@ -33,7 +33,7 @@ from falcon.util import structures
|
||
|
from falcon.util.misc import isascii
|
||
|
from falcon.util.uri import parse_host
|
||
|
from falcon.util.uri import parse_query_string
|
||
|
-from falcon.vendor import mimeparse
|
||
|
+import mimeparse
|
||
|
|
||
|
DEFAULT_ERROR_LOG_FORMAT = '{0:%Y-%m-%d %H:%M:%S} [FALCON] [ERROR] {1} {2}{3} => '
|
||
|
|
||
|
diff --git a/setup.cfg b/setup.cfg
|
||
|
index 30cd181..fc918e8 100644
|
||
|
--- a/setup.cfg
|
||
|
+++ b/setup.cfg
|
||
|
@@ -52,6 +52,7 @@ include_package_data = True
|
||
|
packages = find:
|
||
|
python_requires = >=3.7
|
||
|
install_requires =
|
||
|
+ python-mimeparse >= 1.5.2
|
||
|
tests_require =
|
||
|
testtools
|
||
|
requests
|
||
|
diff --git a/setup.py b/setup.py
|
||
|
index fc12ec3..2c5863c 100644
|
||
|
--- a/setup.py
|
||
|
+++ b/setup.py
|
||
|
@@ -80,7 +80,6 @@ def get_cython_options():
|
||
|
'falcon.media',
|
||
|
'falcon.routing',
|
||
|
'falcon.util',
|
||
|
- 'falcon.vendor.mimeparse',
|
||
|
]
|
||
|
|
||
|
modules_to_exclude = [
|
||
|
diff --git a/tests/test_deps.py b/tests/test_deps.py
|
||
|
index 73e28e1..061dfc2 100644
|
||
|
--- a/tests/test_deps.py
|
||
|
+++ b/tests/test_deps.py
|
||
|
@@ -1,16 +1,17 @@
|
||
|
-from falcon.vendor import mimeparse
|
||
|
-
|
||
|
-
|
||
|
-# TODO(vytas): Remove this test since it makes little sense now that
|
||
|
-# we have vendored python-mimeparse?
|
||
|
+import mimeparse
|
||
|
|
||
|
|
||
|
def test_deps_mimeparse_correct_package():
|
||
|
"""Ensure we are dealing with python-mimeparse, not mimeparse."""
|
||
|
|
||
|
- tokens = mimeparse.mimeparse.__version__.split('.')
|
||
|
+ tokens = mimeparse.__version__.split('.')
|
||
|
+ msg = (
|
||
|
+ 'Incorrect dependency detected. Please install the '
|
||
|
+ '"python-mimeparse" package instead of the "mimeparse" '
|
||
|
+ 'package.'
|
||
|
+ )
|
||
|
|
||
|
# NOTE(kgriffs): python-mimeparse starts at version 1.5.2,
|
||
|
# whereas the mimeparse package is at version 0.1.4 at the time
|
||
|
# of this writing.
|
||
|
- assert int(tokens[0]) > 0, 'Incorrect vendored dependency version detected'
|
||
|
+ assert int(tokens[0]) > 0, msg
|
||
|
--
|
||
|
2.37.1
|
||
|
|