|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | + |
| 3 | +import io |
| 4 | +import os |
| 5 | + |
| 6 | +from setuptools import find_packages, setup |
| 7 | + |
| 8 | +# Package meta-data. |
| 9 | +NAME = "cicflowmeter" |
| 10 | +DESCRIPTION = "CICFlowMeter V3 Python Implementation" |
| 11 | +URL = "https://gitlab.com/hieulw/cicflowmeter" |
| 12 | + |
| 13 | +AUTHOR = "Le Hieu" |
| 14 | +REQUIRES_PYTHON = ">=3.7.0" |
| 15 | +VERSION = None |
| 16 | + |
| 17 | + |
| 18 | +def get_requirements(source: str = "requirements.txt"): |
| 19 | + requirements = [] |
| 20 | + with open(source) as f: |
| 21 | + for line in f: |
| 22 | + package, _, comment = line.partition("#") |
| 23 | + package = package.strip() |
| 24 | + if package: |
| 25 | + requirements.append(package) |
| 26 | + |
| 27 | + return requirements |
| 28 | + |
| 29 | + |
| 30 | +REQUIRED = get_requirements("requirements.txt") |
| 31 | + |
| 32 | +# The rest you shouldn't have to touch too much :) |
| 33 | +# ------------------------------------------------ |
| 34 | +# Except, perhaps the License and Trove Classifiers! |
| 35 | +# If you do change the License, remember to change the Trove Classifier for that! |
| 36 | + |
| 37 | +here = os.path.abspath(os.path.dirname(__file__)) |
| 38 | + |
| 39 | +# Import the README and use it as the long-description. |
| 40 | +# Note: this will only work if 'README.md' is present in your MANIFEST.in file! |
| 41 | +try: |
| 42 | + with io.open(os.path.join(here, "README.md"), encoding="utf-8") as f: |
| 43 | + long_description = "\n" + f.read() |
| 44 | +except FileNotFoundError: |
| 45 | + long_description = DESCRIPTION |
| 46 | + |
| 47 | +# Load the package's __version__.py module as a dictionary. |
| 48 | +about = {} |
| 49 | +if not VERSION: |
| 50 | + prefix = "src" |
| 51 | + project_slug = NAME.lower().replace("-", "_").replace(" ", "_") |
| 52 | + with open(os.path.join(here, prefix, project_slug, "__init__.py")) as f: |
| 53 | + exec(f.read(), about) |
| 54 | +else: |
| 55 | + about["__version__"] = VERSION |
| 56 | + |
| 57 | +# Where the magic happens: |
| 58 | +setup( |
| 59 | + name=NAME, |
| 60 | + version=about["__version__"], |
| 61 | + description=DESCRIPTION, |
| 62 | + long_description=long_description, |
| 63 | + long_description_content_type="text/markdown", |
| 64 | + author=AUTHOR, |
| 65 | + author_email=EMAIL, |
| 66 | + python_requires=REQUIRES_PYTHON, |
| 67 | + url=URL, |
| 68 | + packages=find_packages("src"), |
| 69 | + # package_dir={"cicflowmeter": "src/cicflowmeter"}, |
| 70 | + package_dir={"": "src"}, |
| 71 | + entry_points={ |
| 72 | + "console_scripts": ["cicflowmeter=cicflowmeter.sniffer:main"], |
| 73 | + }, |
| 74 | + install_requires=REQUIRED, |
| 75 | + include_package_data=True, |
| 76 | + license="MIT", |
| 77 | + classifiers=[ |
| 78 | + "License :: OSI Approved :: MIT License", |
| 79 | + "Programming Language :: Python", |
| 80 | + "Programming Language :: Python :: 3", |
| 81 | + "Programming Language :: Python :: 3.7", |
| 82 | + "Programming Language :: Python :: Implementation :: CPython", |
| 83 | + "Programming Language :: Python :: Implementation :: PyPy", |
| 84 | + ], |
| 85 | +) |
0 commit comments