mirror of
https://github.com/correl/openapi-core.git
synced 2024-11-25 11:09:53 +00:00
Python 2.7: Requirements for older python and patches for imports
This commit is contained in:
parent
b8c03d90f4
commit
e3dfee56cd
4 changed files with 26 additions and 1 deletions
|
@ -1,5 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
"""Python 2.7 backward compatibility"""
|
||||||
|
import openapi_core._python27_patch
|
||||||
|
|
||||||
"""OpenAPI core module"""
|
"""OpenAPI core module"""
|
||||||
from openapi_core.shortcuts import (
|
from openapi_core.shortcuts import (
|
||||||
create_spec, validate_parameters, validate_body, validate_data,
|
create_spec, validate_parameters, validate_body, validate_data,
|
||||||
|
|
14
openapi_core/_python27_patch.py
Normal file
14
openapi_core/_python27_patch.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import functools
|
||||||
|
try:
|
||||||
|
from functools import lru_cache
|
||||||
|
|
||||||
|
except ImportError:
|
||||||
|
from backports.functools_lru_cache import lru_cache
|
||||||
|
functools.lru_cache = lru_cache
|
||||||
|
|
||||||
|
try:
|
||||||
|
from functools import partialmethod
|
||||||
|
|
||||||
|
except ImportError:
|
||||||
|
from backports.functools_partialmethod import partialmethod
|
||||||
|
functools.partialmethod = partialmethod
|
5
requirements_2.7.txt
Normal file
5
requirements_2.7.txt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
openapi-spec-validator
|
||||||
|
six
|
||||||
|
backports.functools-lru-cache
|
||||||
|
backports.functools-partialmethod
|
||||||
|
enum34
|
5
setup.py
5
setup.py
|
@ -53,6 +53,8 @@ init_path = os.path.join('openapi_core', '__init__.py')
|
||||||
init_py = read_file(init_path)
|
init_py = read_file(init_path)
|
||||||
metadata = get_metadata(init_py)
|
metadata = get_metadata(init_py)
|
||||||
|
|
||||||
|
py27 = '_2.7' if sys.version_info < (3,) else ''
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='openapi-core',
|
name='openapi-core',
|
||||||
|
@ -69,11 +71,12 @@ setup(
|
||||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||||
"Operating System :: OS Independent",
|
"Operating System :: OS Independent",
|
||||||
'Programming Language :: Python :: 3.4',
|
'Programming Language :: Python :: 3.4',
|
||||||
|
'Programming Language :: Python :: 3.4',
|
||||||
'Programming Language :: Python :: 3.5',
|
'Programming Language :: Python :: 3.5',
|
||||||
'Programming Language :: Python :: 3.6',
|
'Programming Language :: Python :: 3.6',
|
||||||
'Topic :: Software Development :: Libraries',
|
'Topic :: Software Development :: Libraries',
|
||||||
],
|
],
|
||||||
install_requires=read_requirements('requirements.txt'),
|
install_requires=read_requirements('requirements{}.txt'.format(py27)),
|
||||||
tests_require=read_requirements('requirements_dev.txt'),
|
tests_require=read_requirements('requirements_dev.txt'),
|
||||||
extras_require={
|
extras_require={
|
||||||
'flask': ["werkzeug"],
|
'flask': ["werkzeug"],
|
||||||
|
|
Loading…
Reference in a new issue