-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
58 lines (51 loc) · 2 KB
/
Copy pathsetup.py
File metadata and controls
58 lines (51 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py
class BuildPyWithRegions(build_py):
"""Fetch latest regions.json from Contentstack CDN before packaging."""
def run(self):
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
try:
from contentstack_utils.region_refresh import refresh_regions
refresh_regions()
except Exception as exc:
# Never block a build over a network failure — warn and continue.
print(f"WARNING: Could not refresh regions.json: {exc}", file=sys.stderr)
super().run()
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
long_description = readme.read()
setup(
name='contentstack_utils',
packages=find_packages(),
package_data={
"contentstack_utils": ["assets/regions.json"],
},
description="contentstack_utils is a Utility package for Contentstack headless CMS with an API-first approach.",
author='contentstack',
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/contentstack/contentstack-utils-python",
license='MIT',
version='1.6.1',
install_requires=[
# lxml 6.x requires Python 3.8+; keep 4.x for 3.6–3.7 (python_requires>=3.6).
"lxml>=4.9.0,<5; python_version<'3.8'",
"lxml>=6.1.0; python_version>='3.8'",
],
setup_requires=['pytest-runner'],
tests_require=['pytest==4.4.1'],
test_suite='tests',
cmdclass={"build_py": BuildPyWithRegions},
classifiers=[
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
'Intended Audience :: Developers',
'Natural Language :: English',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
python_requires='>=3.6',
)