Sync from SUSE:SLFO:Main python-falcon revision 5129323b8b7946e1d2c1d076e18eb26b

This commit is contained in:
Adrian Schröter 2024-05-03 20:38:13 +02:00
commit 74140d100a
5 changed files with 667 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

BIN
falcon-3.1.1.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,13 @@
Index: falcon-3.1.1/docs/conf.py
===================================================================
--- falcon-3.1.1.orig/docs/conf.py
+++ falcon-3.1.1/docs/conf.py
@@ -134,7 +134,7 @@ exclude_patterns = ['_build', '_newsfrag
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'github'
+pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []

494
python-falcon.changes Normal file
View File

@ -0,0 +1,494 @@
-------------------------------------------------------------------
Tue Jan 2 23:52:59 UTC 2024 - Jiri Srain <jsrain@suse.com>
- removed unneeded build dependency on python3-pygments-style-railscasts
-------------------------------------------------------------------
Sun Jun 11 13:33:16 UTC 2023 - ecsos <ecsos@opensuse.org>
- Add %{?sle15_python_module_pythons}
-------------------------------------------------------------------
Mon Jan 16 12:51:53 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
- Update to 3.1.1:
Falcon 3.1.1 is a minor point release addressing a couple of high impact
bugs, and enabling the framework on the recently released CPython 3.11.
- 3.1.0
This release contains several refinements to request validation and error
handling, along with some tweaks to response handling for static and
downloadable files.
Due to popular demand, TestClient and ASGIConductor now expose convenience
shorthand aliases for the simulate_* methods, i.e., simulate_get() is now
also available as get(), etc.
Some important bugs were also fixed to ensure applications properly clean up
response streams and do not hang when reading request bodies that are
streamed using chunked transfer encoding.
This release also adds support for CPython 3.10 and deprecates CPython 3.6.
-------------------------------------------------------------------
Thu Dec 9 09:41:05 UTC 2021 - pgajdos@suse.com
- do not require pytest-runner for build, not required
-------------------------------------------------------------------
Tue Nov 23 19:28:50 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Don't restrict to primary python3 flavor. Other packages depend
on this.
- Update requirements
* The only runtime deps have been removed in version 2.0
* Test requirements from examples are obsolete
- Implement some python packaging best practises:
* Check for version in dist metadata
* uninstall alternative only takes master (there was even a typo)
-------------------------------------------------------------------
Mon Nov 22 16:25:06 UTC 2021 - Matej Cepl <mcepl@suse.com>
- Don't create %%{python_sitelib}/examples directory, that' just
evil.
-------------------------------------------------------------------
Wed Nov 17 12:09:52 UTC 2021 - Andreas Schneider <asn@cryptomilk.org>
- Update to version 3.0.1
This is a minor point release to take care of a couple of bugs
that we did not catch for 3.0.0.
- The api_helpers module was re-added, since it was renamed
to app_helpers (and effectively removed) without announcing
a corresponding breaking change. This module is now
considered deprecated, and will be removed in a future Falcon
version.
- ASGI HTTP headers were treated as UTF-8 encoded, not
taking the incompatibility with WSGI and porting of WSGI
applications into consideration. This was fixed, and ASGI
headers are now decoded and encoded as ISO-8859-1.
-------------------------------------------------------------------
Tue Mar 17 04:47:20 UTC 2020 - Steve Kowalik <steven.kowalik@suse.com>
- No longer build for Python 2 given not all dependencies build for it.
-------------------------------------------------------------------
Tue Jun 11 10:02:39 UTC 2019 - Thomas Bechtold <tbechtold@suse.com>
- Drop python-mujson BuildRequires
-------------------------------------------------------------------
Tue Jun 11 09:19:27 UTC 2019 - Thomas Bechtold <tbechtold@suse.com>
- Drop %patch1 which is no longer available
- Drop python-rapidjson dependency again
-------------------------------------------------------------------
Thu Jun 6 09:26:50 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Add dependency over the rapidjson and remove patch:
* python-falcon-no-rapidjson.patch
-------------------------------------------------------------------
Wed May 22 12:23:42 UTC 2019 - pgajdos@suse.com
- version update to 2.0.0
* many changes, see CHANGES.rst
- deleted patches
- remove_failing_test.patch (not needed)
- added patches
rapidjson implementation python binding not available.
+ python-falcon-no-rapidjson.patch
github pygments style is not available
+ python-falcon-sphinx-pygments-style.patch
-------------------------------------------------------------------
Thu Apr 19 22:01:11 UTC 2018 - mimi.vx@gmail.com
- use %license macro
-------------------------------------------------------------------
Tue Mar 6 13:56:37 UTC 2018 - aplanas@suse.com
- Allows Recommends and Suggest in Fedora
-------------------------------------------------------------------
Tue Feb 27 17:16:01 UTC 2018 - aplanas@suse.com
- Suggests only for SUSE
-------------------------------------------------------------------
Wed Jan 17 03:58:52 UTC 2018 - arun@gmx.de
- specfile:
* update copyright year
* require pygments-style-railscasts to build documentation
- update to version 1.4.1:
* Fixed
+ Reverted the breaking change in 1.4.0 to
"falcon.testing.Result.json". Minor releases should have no
breaking changes.
+ The README was not rendering properly on PyPI. This was fixed
and a validation step was added to the build process.
- changes from version 1.4.0:
* New & Improved
+ We added a new method, API.add_static_route(), that makes it
easy to serve files from a local directory. This feature
provides an alternative to serving files from the web server
when you don't have that option, when authorization is required,
or for testing purposes.
+ Arguments can now be passed to hooks.
+ The default JSON media type handler will now use ujson, if
available, to speed up JSON (de)serialization under CPython.
+ Semantic validation via the format keyword is now enabled for
the falcon.media.validators.jsonschema.validate() JSON Schema
decorator.
+ We added a new helper, falcon.Request.get_param_as_uuid(), to
the Request class.
+ We added a new property, downloadable_as, to the Response class
for setting the Content-Disposition header.
+ Falcon now supports WebDAV methods (RFC 3253), such as UPDATE
and REPORT.
+ falcon.routing.create_http_method_map has been refactored into
two new methods, falcon.routing.map_http_methods and
falcon.routing.set_default_responders, so that custom routers
can better pick and choose the functionality they need. The
original method is still available for backwards-compatibility,
but will be removed in a future release.
+ We added a new json param to falcon.testing.simulate_request()
et al. to automatically serialize the request body from a JSON
serializable object or type (for a complete list of serializable
types, see json.JSONEncoder).
+ TestClient's simulate_*() methods now call
TestClient.simulate_request to make it easier for subclasses to
override TestClient's behavior.
+ TestClient can now be configured with a default set of headers
to send with every request.
+ testing.Result.json now returns None when the response body is
empty, rather than raising an error.
+ The FAQ has been reorganized and greatly expanded.
+ We restyled the docs to match https://falconframework.org
* Fixed
+ Forwarded headers containing quoted strings with commas were not
being parsed correctly. This has been fixed, and the parser
generally made more robust.
+ falcon.media.JSONHandler was raising an error under Python 2.x
when serializing strings containing Unicode code points. This
issue has been fixed.
+ Overriding a resource class and calling its responders via
super() did not work when passing URI template params as
positional arguments. This has now been fixed.
+ Python 3.6 was generating warnings for strings containing '\s'
within Falcon. These strings have been converted to raw strings
to mitigate the warning.
+ Several syntax errors were found and fixed in the code examples
used in the docs.
-------------------------------------------------------------------
Tue Oct 3 05:44:49 UTC 2017 - arun@gmx.de
- specfile:
* require jsonschema
* require msgpack-python
- updated patch
- update to version 1.3.0:
* Changes to Supported Platforms
+ CPython 3.6 is now fully supported.
+ Falcon appears to work well on PyPy3.5, but we are waiting until
that platform is out of beta before officially supporting it.
+ Support for both CPython 2.6 and Jython 2.7 is now deprecated
and will be discontinued in Falcon 2.0.
* New & Improved
+ We added built-in resource representation serialization and
deserialization, including input validation based on JSON
Schema.
+ URI template field converters are now supported. We expect to
expand this feature over time.
+ A new method, get_param_as_datetime(), was added to the Request
class.
+ A number of attributes were added to the Request class to make
proxy information easier to consume. These include the
forwarded, forwarded_uri, forwarded_scheme, forwarded_host, and
forwarded_prefix attributes. The prefix attribute was also added
as part of this work.
+ A referer attribute was added to the Request class.
+ We implemented __repr__() for Request, Response, and HTTPError
to aid in debugging.
+ A number of Internet media type constants were defined to make
it easier to check and set content type headers.
+ Several new 5xx error classes were implemented.
* Fixed
+ If even a single cookie in the request to the server is
malformed, none of the cookies will be parsed
(all-or-nothing). Change the parser to simply skip bad cookies
(best-effort).
+ API instances are not pickleable. Modify the default router to
fix this.
-------------------------------------------------------------------
Sat Sep 2 09:56:45 UTC 2017 - sebix+novell.com@sebix.at
- add patch remove_failing_test.patch removes a broken test
-------------------------------------------------------------------
Fri Aug 25 15:38:18 UTC 2017 - jengelh@inai.de
- Remove filler words from descriptions.
-------------------------------------------------------------------
Wed Aug 2 10:06:33 UTC 2017 - sebix+novell.com@sebix.at
- disable Cython-build because of failing tests
- update to 1.2.0:
* New & Improved
- A new default kwarg was added to falcon.Request.get_header.
- A delete_header() method was added to falcon.Response.
- Several new HTTP status codes and error classes were added, such as falcon.HTTPFailedDependency.
- If ujson is installed it will be used in lieu of json to speed up error serialization and query string parsing under CPython. PyPy users should continue to use json.
- The independent_middleware kwarg was added to falcon.API to enable the execution of process_response() middleware methods, even when process_request() raises an error.
- Single-character field names are now allowed in URL templates when specifying a route.
- A detailed error message is now returned when an attempt is made to add a route that conflicts with one that has already been added.
- The HTTP protocol version can now be specified when simulating requests with the testing framework.
- The falcon.ResponseOptions class was added, along with a secure_cookies_by_default option to control the default value of the "secure" attribute when setting cookies. This can make testing easier by providing a way to toggle whether or not HTTPS is required.
- port, netloc and scheme properties were added to the falcon.Request class. The protocol property is now deprecated and will be removed in a future release.
- The strip_url_path_trailing_slash was added to falcon.RequestOptions to control whether or not to retain the trailing slash in the URL path, if one is present. When this option is enabled (the default), the URL path is normalized by stripping the trailing slash character. This lets the application define a single route to a resource for a path that may or may not end in a forward slash. However, this behavior can be problematic in certain cases, such as when working with authentication schemes that employ URL-based signatures. Therefore, the strip_url_path_trailing_slash option was introduced to make this behavior configurable.
- Improved the documentation for falcon.HTTPError, particularly around customizing error serialization.
- Misc. improvements to the look and feel of Falcon's documentation.
- The tutorial in the docs was revamped, and now includes guidance on testing Falcon applications.
* Fixed
- Certain non-alphanumeric characters, such as parenthesis, are not handled properly in complex URI template path segments that are comprised of both literal text and field definitions.
- When the WSGI server does not provide a wsgi.file_wrapper object, Falcon wraps Response.stream in a simple iterator object that does not implement close(). The iterator should be modified to implement a close() method that calls the underlying stream's close() to free system resources.
- The testing framework does not correctly parse cookies under Jython.
- Whitespace is not stripped when parsing cookies in the testing framework.
- The Vary header is not always set by the default error serializer.
- While not specified in PEP-3333 that the status returned to the WSGI server must be of type str, setting the status on the response to a unicode string under Python 2.6 or 2.7 can cause WSGI servers to raise an error. Therefore, the status string must first be converted if it is of the wrong type.
- The default OPTIONS responder returns 204, when it should return 200. RFC 7231 specifically states that Content-Length should be zero in the response to an OPTIONS request, which implies a status code of 200 since RFC 7230 states that Content-Length must not be set in any response with a status code of 204.
- update to 1.1.0:
* New & Improved
- A new bounded_stream property was added to falcon.Request that can be used in place of the stream property to mitigate the blocking behavior of input objects used by some WSGI servers.
- A new uri_template property was added to falcon.Request to expose the template for the route corresponding to the path requested by the user agent.
- A context property was added to falcon.Response to mirror the same property that is already available for falcon.Request.
- JSON-encoded query parameter values can now be retrieved and decoded in a single step via falcon.Request.get_param_as_dict().
- CSV-style parsing of query parameter values can now be disabled.
- falcon.Request.get_param_as_bool() now recognizes "on" and "off" in support of IE's default checkbox values.
- An accept_ranges property was added to falcon.Response to facilitate setting the Accept-Ranges header.
- Added the falcon.HTTPUriTooLong and falcon.HTTPGone error classes.
- When a title is not specified for falcon.HTTPError, it now defaults to the HTTP status text.
- All parameters are now optional for most error classes.
- Cookie-related documentation has been clarified and expanded
- The falcon.testing.Cookie class was added to represent a cookie returned by a simulated request. falcon.testing.Result now exposes a cookies attribute for examining returned cookies.
- pytest support was added to Falcon's testing framework. Apps can now choose to either write unittest- or pytest-style tests.
- The test runner for Falcon's own tests was switched from nose to pytest.
- When simulating a request using Falcon's testing framework, query string parameters can now be specified as a dict, as an alternative to passing a raw query string.
- A flag is now passed to the process_request middleware method to signal whether or not an exception was raised while processing the request. A shim was added to avoid breaking existing middleware methods that do not yet accept this new parameter.
- A new CLI utility, falcon-print-routes, was added that takes in a module:callable, introspects the routes, and prints the results to stdout. This utility is automatically installed along with the framework:
- $ falcon-print-routes commissaire:api
- -> /api/v0/status
- -> /api/v0/cluster/{name}
- -> /api/v0/cluster/{name}/hosts
- -> /api/v0/cluster/{name}/hosts/{address}
- Custom attributes can now be attached to instances of falcon.Request and falcon.Response. This can be used as an alternative to adding values to the context property, or implementing custom subclasses.
- falcon.get_http_status() was implemented to provide a way to look up a full HTTP status line, given just a status code.
* Fixed
- When auto_parse_form_urlencoded is set to True, the framework now checks the HTTP method before attempting to consume and parse the body.
- Before attempting to read the body of a form-encoded request, the framework now checks the Content-Length header to ensure that a non-empty body is expected. This helps prevent bad requests from causing a blocking read when running behind certain WSGI servers.
- When the requested method is not implemented for the target resource, the framework now raises falcon.HTTPMethodNotAllowed, rather than modifying the falcon.Request object directly. This improves visibility for custom error handlers and for middleware methods.
- Error class docstrings have been updated to reflect the latest RFCs.
- When an error is raised by a resource method or a hook, the error will now always be processed (including setting the appropriate properties of the falcon.Response object) before middleware methods are called.
- A case was fixed in which middleware processing did not continue when an instance of falcon.HTTPError or falcon.HTTPStatus was raised.
- The falcon.uri.encode() method will now attempt to detect whether the specified string has already been encoded, and return it unchanged if that is the case.
- The default OPTIONS responder now explicitly sets Content-Length to zero in the response.
- falcon.testing.Result now assumes that the response body is encoded as UTF-8 when the character set is not specified, rather than raising an error when attempting to decode the response body.
- When simulating requests, Falcon's testing framework now properly tunnels Unicode characters through the WSGI interface.
- import falcon.uri now works, in addition to from falcon import uri.
- URI template fields are now validated up front, when the route is added, to ensure they are valid Python identifiers. This prevents cryptic errors from being raised later on when requests are routed.
- When running under Python 3, inspect.signature() is used instead of inspect.getargspec() to provide compatibility with annotated functions.
-------------------------------------------------------------------
Thu Mar 2 22:26:28 UTC 2017 - dimstar@opensuse.org
- Update Dependency on python-PyYAML: this package had been renamed
a long time ago to follow the naming convention. The compat
symbol 'python-yaml' was lost with the migration to singlespec.
-------------------------------------------------------------------
Sat Dec 3 18:25:46 UTC 2016 - dmueller@suse.com
- update to 1.0.0:
https://falcon.readthedocs.org/en/stable/changes/1.0.0.html
-------------------------------------------------------------------
Mon Feb 29 21:41:46 UTC 2016 - dmueller@suse.com
- update to 0.3.0:
https://falcon.readthedocs.org/en/stable/changes/0.3.0.html
-------------------------------------------------------------------
Fri Jan 29 13:02:36 UTC 2016 - dev@stellardeath.org
- Add missing requirement "python-python-mimeparse"
-------------------------------------------------------------------
Mon May 4 17:49:09 UTC 2015 - benoit.monin@gmx.fr
- update to version 0.2:
* Since 0.1 we've added proper RTD docs to make it easier for
everyone to get started with the framework. Over time we will
continue adding content, and we would love your help!
* Falcon now supports "wsgi.filewrapper". You can assign any
file-like object to resp.stream and Falcon will use
"wsgi.filewrapper" to more efficiently pipe the data to the
WSGI server.
* Support was added for automatically parsing requests containing
"application/x-www-form-urlencoded" content. Form fields are
now folded into req.params.
* Custom Request and Response classes are now supported. You can
specify custom types when instantiating falcon.API.
* A new middleware feature was added to the framework. Middleware
deprecates global hooks, and we encourage everyone to migrate
as soon as possible.
* A general-purpose dict attribute was added to Request.
Middleware, hooks, and responders can now use req.context to
share contextual information about the current request.
* A new method, append_header, was added to falcon.API to allow
setting multiple values for the same header using comma
separation.
* A new "resource" attribute was added to hooks. Old hooks that
do not accept this new attribute are shimmed so that they will
continue to function.
* Error response bodies now support XML in addition to JSON. In
addition, the HTTPError serialization code was refactored to
make it easier to implement a custom error serializer.
* A new method, "set_error_serializer" was added to falcon.API.
You can use this method to override Falcon's default HTTPError
serializer if you need to support custom media types.
* Falcon's testing base class, testing.TestBase was improved to
facilitate Py3k testing.
* An "add_link" method was added to the Response class. Apps can
use this method to add one or more Link header values to a
response.
* Added two new properties, req.host and req.subdomain, to make
it easier to get at the hostname info in the request.
* Allow a wider variety of characters to be used in query string
params.
* Internal APIs have been refactored to allow overriding the
default routing mechanism. Further modularization is planned
for the next release (0.3).
* Changed req.get_param so that it behaves the same whether a
list was specified in the query string using the HTML form
style (in which each element is listed in a separate 'key=val'
field) or in the more compact API style (in which each element
is comma-separated and assigned to a single param instance, as
in 'key=val1,val2,val3')
* Added a convenience method, set_stream(...), to the Response
class for setting the stream and its length at the same time,
which should help people not forget to set both (and save a few
keystrokes along the way).
* Added several new error classes, including
HTTPRequestEntityTooLarge, HTTPInvalidParam, HTTPMissingParam,
HTTPInvalidHeader and HTTPMissingHeader.
* Python 3.4 is now fully supported.
* Various minor performance improvements
* The deprecated util.misc.percent_escape and
util.misc.percent_unescape functions were removed. Please use
the functions in the util.uri module instead.
* The deprecated function, API.set_default_route, was removed.
Please use sinks instead.
* HTTPRangeNotSatisfiable no longer accepts a media_type
parameter.
* When using the comma-delimited list convention,
req.get_param_as_list(...) will no longer insert placeholders,
using the None type, for empty elements.
* Ensure 100% test coverage and fix any bugs identified in the
process.
* Fix not recognizing the "bytes=" prefix in Range headers.
* Make HTTPNotFound and HTTPMethodNotAllowed fully compliant,
according to RFC 7231.
* Fixed the default on_options responder causing a Cython type
error.
* URI template strings can now be of type unicode under Python 2.
* When SCRIPT_NAME is not present in the WSGI environ, return an
empty string for the req.app property.
* Global "after" hooks will now be executed even when a responder
raises an error.
* Fixed several minor issues regarding testing.create_environ(...)
* Work around a wsgiref quirk, where if no content-length header
is submitted by the client, wsgiref will set the value of that
header to an empty string in the WSGI environ.
* Resolved an issue causing several source files to not be
Cythonized.
* Docstrings have been edited for clarity and correctness.
- additional changes from version 0.1.10:
* SCRIPT_NAME may not always be present in the WSGI environment,
so treat it as an empty string if not present.
- additional changes from version 0.1.9:
* Addressed style issues reported by the latest pyflakes version
* Fixed body not being decoded from UTF-8 in HTTPError tests
* Remove unnecessary ordereddict requirement on Python 2.6
- additional changes from version 0.1.8:
* srmock.headers have been normalized such that header names are
always lowercase. This was done to make tests that rely on
srmock less fragile.
* Falcon now sends response headers as all lower-case ala node.js.
* The 'scheme' argument to HTTPUnauthorized can no longer be
passed positionally; it must be a named argument.
* You can no longer overload a single resource class to respond
to multiple routes that differ by URI template params.
* srmock.headers_dict is now implemented using a case-insensitive
dict
* Per RFC 3986, Falcon now decodes escaped characters in the
query string, plus convert '+' -> ' '. Also, Falcon now decodes
multi-byte UTF-8 sequences after they have been unescaped.
* Custom error handlers can be registered via a new
API.add_error_handler method.
* Support for "request sinks" was added to falcon.API.
* uri module added to falcon.util which includes utilities for
encoding and decoding URIs, as well as parsing a query string
into a dict.
* Subsequent calls to req.uri are now faster since the property
now clones a cached dict instead of building a new one from
scratch each time.
* falcon.util now includes a case-insensitive dict borrowed from
the Requests library.
* Misc. performance optimizations to offset the impact of
supporting case-sensitive headers and rigorous URI
encoding/decoding.
* Py33 performance improvements
- add python-ddt and python-yaml as BuildRequires for the tests
- remove unwanted shebang of bench.py
- add -fno-strict-aliasing to CFLAGS to avoid compiler warnings
- pass -q to test to avoid spamming the build log
- remove AUTHORS CHANGES.md LICENSE: no provided anymore
- remove README.md: its content is identical to README.rst
-------------------------------------------------------------------
Mon Sep 30 15:31:12 UTC 2013 - speilicke@suse.com
- Fix description
-------------------------------------------------------------------
Tue Sep 17 08:49:17 UTC 2013 - dmueller@suse.com
- update to 0.1.7:
* req.get_params_as_list now inserts None as a placeholder for missing
elements, and returns None all by itself if the param is present in the
query string, but has an empty string as its value. (kgriffs)
-------------------------------------------------------------------
Mon Sep 9 09:22:07 UTC 2013 - speilicke@suse.com
- Add python-ordereddict test build requirement for SLE_11_SP3
-------------------------------------------------------------------
Mon Sep 9 08:24:35 UTC 2013 - speilicke@suse.com
- Initial version

134
python-falcon.spec Normal file
View File

@ -0,0 +1,134 @@
#
# spec file for package python-falcon
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?sle15_python_module_pythons}
Name: python-falcon
Version: 3.1.1
Release: 0
Summary: A web framework for building APIs and app backends
License: Apache-2.0
Group: Development/Languages/Python
URL: http://falconframework.org
Source: https://github.com/falconry/falcon/archive/%{version}.tar.gz#./falcon-%{version}.tar.gz
# The file on pypi misses docs/ext, should be fixed in next version
# Source: https://files.pythonhosted.org/packages/source/f/falcon/falcon-%%{version}.tar.gz
# github pygments style is not available
Patch0: python-falcon-sphinx-pygments-style.patch
BuildRequires: %{python_module PyYAML}
BuildRequires: %{python_module Sphinx}
BuildRequires: %{python_module ddt}
BuildRequires: %{python_module httpx}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module sphinx-tabs}
BuildRequires: %{python_module websockets}
# TODO: Cython support
#BuildRequires: %%{python_module Cython}
# SECTION test requirements
BuildRequires: %{python_module aiofiles}
BuildRequires: %{python_module cbor2}
BuildRequires: %{python_module msgpack-python}
BuildRequires: %{python_module pytest-asyncio}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module requests}
BuildRequires: %{python_module testtools}
BuildRequires: %{python_module ujson}
%if 0%{?suse_version} >= 1550
BuildRequires: %{python_module httpx if (%python-base without python36-base)}
BuildRequires: %{python_module uvicorn if (%python-base without python36-base)}
BuildRequires: %{python_module websockets if (%python-base without python36-base)}
%endif
# /SECTION
BuildRequires: fdupes
BuildRequires: python-rpm-macros
#Requires: python-Cython
Requires(post): update-alternatives
Requires(postun):update-alternatives
Suggests: %{name}-doc
BuildArch: noarch
%python_subpackages
%package -n %{name}-doc
Summary: Documentation files for %{name}
Group: Documentation/HTML
Provides: %{python_module falcon-doc = %{version}}
%description
Falcon is a Python framework for building cloud
APIs. It encourages the REST architectural style, and tries to do
as little as possible while remaining effective.
%description -n %{name}-doc
HTML documentation including API documentation and changelog for %{name}.
%prep
%setup -q -n falcon-%{version}
%patch0 -p1
# remove unwanted shebang
sed -i '1s/^#!.*//' falcon/bench/bench.py falcon/cmd/inspect_app.py falcon/bench/dj/manage.py
chmod a-x falcon/bench/dj/manage.py
# we don't want to require rapidjson just for testing
rm tests/test_media_handlers.py
# Hidden files are evil
rm examples/asgilook/.coveragerc
%build
export CFLAGS="%{optflags} -fno-strict-aliasing"
%python_build
export PYTHONPATH="$(pwd)"
pushd docs
make html
rm _build/html/.buildinfo
popd
%install
%python_install
%python_clone -a %{buildroot}%{_bindir}/falcon-bench
%python_clone -a %{buildroot}%{_bindir}/falcon-inspect-app
%python_clone -a %{buildroot}%{_bindir}/falcon-print-routes
%{python_expand rm -rf %{buildroot}%{$python_sitelib}/examples
%fdupes %{buildroot}%{$python_sitelib}
}
%check
export LANG=en_US.UTF8
# there are no websockets and httpx for python 3.6
python36_donttest=("--ignore" "tests/asgi")
if [ %{python3_version_nodots} -eq 36 ]; then
python3_donttest=("--ignore" "tests/asgi")
fi
%pytest "${$python_donttest[@]}" tests
%post
%{python_install_alternative falcon-bench falcon-inspect-app falcon-print-routes}
%postun
%python_uninstall_alternative falcon-bench
%files %{python_files}
%doc README.rst CHANGES.rst examples/
%license LICENSE
%python_alternative %{_bindir}/falcon-bench
%python_alternative %{_bindir}/falcon-inspect-app
%python_alternative %{_bindir}/falcon-print-routes
%{python_sitelib}/falcon
%{python_sitelib}/falcon-%{version}*-info
%files -n %{name}-doc
%doc docs/_build/html
%changelog