Skip to content

Commit

Permalink
feat(build-system): this file is the build script for setuptools
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsanima committed Jun 2, 2021
1 parent 6839cab commit 54f990e
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
"""
mdsanima-dev Setup Package
"""

import sys
import json
import setuptools

# Get python current and required version from users.
CURRENT_PYTHON = sys.version_info[:2]
REQUIRED_PYTHON = (3, 6)

# Initial stderr checking print variable.
mds_sep = ("=" * 26)
mds_uns = "Unsupported Python Version"
mds_ver = "This version of mdsanima-dev requires Python {}.{}"
mds_ins = "but you're trying to install it on Python {}.{}"

# This check and everything above must remain compatible with Python 3.6.
if CURRENT_PYTHON < REQUIRED_PYTHON:
sys.stderr.write((
mds_sep, "\n", mds_uns, "\n", mds_sep, "\n",
mds_ver, "\n", mds_ins
).format(*(REQUIRED_PYTHON + CURRENT_PYTHON)))
sys.exit(1)

# Load data from package.json file.
with open("package.json") as dt:
data_package = json.load(dt)

# Load data from README.md file.
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()

# Setuptools dynamic package arguments, nice and clean.
setuptools.setup(
name=data_package["name"],
version=data_package["version"],
author=data_package["author"]["name"],
author_email=data_package["author"]["email"],
description=data_package["description"],
long_description=long_description,
long_description_content_type="text/markdown",
url=data_package["homepage"],
project_urls=data_package["project_urls"],
classifiers=data_package["classifiers"],
package_dir={"": "src"},
packages=setuptools.find_packages(where="src"),
python_requires=">=3.6",
license=data_package["license"],
extras_require=data_package["extra_require"],
keywords=data_package["keywords"],
)

0 comments on commit 54f990e

Please sign in to comment.