|
| 1 | +import os |
| 2 | +import sys |
| 3 | +from pathlib import Path |
| 4 | + |
| 5 | +from setuptools import find_packages, setup |
| 6 | + |
| 7 | + |
| 8 | +# the name of the project |
| 9 | +name = "django_idom" |
| 10 | + |
| 11 | +# basic paths used to gather files |
| 12 | +root_dir = Path(__file__).parent |
| 13 | +src_dir = root_dir / "src" |
| 14 | +package_dir = src_dir / name |
| 15 | + |
| 16 | + |
| 17 | +# ----------------------------------------------------------------------------- |
| 18 | +# Package Definition |
| 19 | +# ----------------------------------------------------------------------------- |
| 20 | + |
| 21 | + |
| 22 | +package = { |
| 23 | + "name": name, |
| 24 | + "python_requires": ">=3.7", |
| 25 | + "packages": find_packages(str(src_dir)), |
| 26 | + "package_dir": {"": "src"}, |
| 27 | + "description": "Control the web with Python", |
| 28 | + "author": "Ryan Morshead", |
| 29 | + "author_email": "ryan.morshead@gmail.com", |
| 30 | + "url": "https://github.com/idom-team/django-idom", |
| 31 | + "license": "MIT", |
| 32 | + "platforms": "Linux, Mac OS X, Windows", |
| 33 | + "keywords": ["interactive", "widgets", "DOM", "React"], |
| 34 | + "zip_safe": False, |
| 35 | + "classifiers": [ |
| 36 | + "Framework :: Django", |
| 37 | + "Framework :: Django :: 3.1", |
| 38 | + "Framework :: Django :: 3.2", |
| 39 | + "Operating System :: OS Independent", |
| 40 | + "Intended Audience :: Developers", |
| 41 | + "Intended Audience :: Science/Research", |
| 42 | + "Topic :: Multimedia :: Graphics", |
| 43 | + "Programming Language :: Python :: 3.7", |
| 44 | + "Programming Language :: Python :: 3.8", |
| 45 | + "Programming Language :: Python :: 3.9", |
| 46 | + "Environment :: Web Environment", |
| 47 | + ], |
| 48 | +} |
| 49 | + |
| 50 | + |
| 51 | +# ----------------------------------------------------------------------------- |
| 52 | +# Library Version |
| 53 | +# ----------------------------------------------------------------------------- |
| 54 | + |
| 55 | +with open(os.path.join(package_dir, "__init__.py")) as f: |
| 56 | + for line in f.read().split("\n"): |
| 57 | + if line.startswith("__version__ = "): |
| 58 | + package["version"] = eval(line.split("=", 1)[1]) |
| 59 | + break |
| 60 | + else: |
| 61 | + print("No version found in %s/__init__.py" % package_dir) |
| 62 | + sys.exit(1) |
| 63 | + |
| 64 | + |
| 65 | +# ----------------------------------------------------------------------------- |
| 66 | +# Requirements |
| 67 | +# ----------------------------------------------------------------------------- |
| 68 | + |
| 69 | + |
| 70 | +requirements = [] |
| 71 | +with (root_dir / "requirements" / "pkg-deps.txt").open() as f: |
| 72 | + for line in map(str.strip, f): |
| 73 | + if not line.startswith("#"): |
| 74 | + requirements.append(line) |
| 75 | +package["install_requires"] = requirements |
| 76 | + |
| 77 | + |
| 78 | +# ----------------------------------------------------------------------------- |
| 79 | +# Library Description |
| 80 | +# ----------------------------------------------------------------------------- |
| 81 | + |
| 82 | + |
| 83 | +with (root_dir / "README.md").open() as f: |
| 84 | + long_description = f.read() |
| 85 | + |
| 86 | +package["long_description"] = long_description |
| 87 | +package["long_description_content_type"] = "text/markdown" |
| 88 | + |
| 89 | + |
| 90 | +# ----------------------------------------------------------------------------- |
| 91 | +# Install It |
| 92 | +# ----------------------------------------------------------------------------- |
| 93 | + |
| 94 | + |
| 95 | +if __name__ == "__main__": |
| 96 | + setup(**package) |
0 commit comments