2018-12-17 21:29:15 +00:00
|
|
|
#!/usr/bin/env python3
|
2018-11-04 13:07:02 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2018-11-27 22:37:38 +00:00
|
|
|
|
|
|
|
|
2018-11-04 19:23:11 +00:00
|
|
|
"""
|
|
|
|
This file is part of nucypher.
|
|
|
|
|
|
|
|
nucypher is free software: you can redistribute it and/or modify
|
2019-03-05 02:50:11 +00:00
|
|
|
it under the terms of the GNU Affero General Public License as published by
|
2018-11-04 19:23:11 +00:00
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
nucypher is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2019-03-05 02:50:11 +00:00
|
|
|
GNU Affero General Public License for more details.
|
2018-11-04 19:23:11 +00:00
|
|
|
|
2019-03-05 02:50:11 +00:00
|
|
|
You should have received a copy of the GNU Affero General Public License
|
2018-11-04 19:23:11 +00:00
|
|
|
along with nucypher. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
"""
|
2020-06-26 02:52:04 +00:00
|
|
|
|
2018-11-04 13:07:02 +00:00
|
|
|
import os
|
2023-08-25 00:17:05 +00:00
|
|
|
import sys
|
2020-05-28 18:53:29 +00:00
|
|
|
from pathlib import Path
|
2022-05-13 15:43:10 +00:00
|
|
|
from typing import Dict
|
2020-12-20 09:27:59 +00:00
|
|
|
from urllib.parse import urlparse
|
|
|
|
|
2020-05-28 18:53:29 +00:00
|
|
|
from setuptools import find_packages, setup
|
2020-04-24 17:52:27 +00:00
|
|
|
from setuptools.command.develop import develop
|
2018-11-04 13:07:02 +00:00
|
|
|
from setuptools.command.install import install
|
2020-06-26 02:52:04 +00:00
|
|
|
|
2018-11-04 13:07:02 +00:00
|
|
|
#
|
|
|
|
# Metadata
|
|
|
|
#
|
|
|
|
|
|
|
|
PACKAGE_NAME = 'nucypher'
|
2020-05-28 18:53:29 +00:00
|
|
|
BASE_DIR = Path(__file__).parent
|
2020-04-24 17:52:27 +00:00
|
|
|
PYPI_CLASSIFIERS = [
|
2023-05-02 19:51:16 +00:00
|
|
|
"Development Status :: 3 - Alpha",
|
|
|
|
"Intended Audience :: Developers",
|
|
|
|
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
|
|
|
|
"Natural Language :: English",
|
|
|
|
"Operating System :: OS Independent",
|
|
|
|
"Programming Language :: Python",
|
|
|
|
"Programming Language :: Python :: 3 :: Only",
|
2023-09-28 10:33:45 +00:00
|
|
|
"Programming Language :: Python :: 3.8",
|
2023-05-02 19:51:16 +00:00
|
|
|
"Programming Language :: Python :: 3.9",
|
|
|
|
"Programming Language :: Python :: 3.10",
|
2023-08-25 00:17:05 +00:00
|
|
|
"Programming Language :: Python :: 3.11",
|
2023-11-03 18:24:59 +00:00
|
|
|
"Programming Language :: Python :: 3.12",
|
2023-05-02 19:51:16 +00:00
|
|
|
"Topic :: Security",
|
2020-04-24 17:52:27 +00:00
|
|
|
]
|
2018-11-04 13:07:02 +00:00
|
|
|
|
2020-05-24 09:39:02 +00:00
|
|
|
ABOUT: Dict[str, str] = dict()
|
2020-05-28 18:53:29 +00:00
|
|
|
SOURCE_METADATA_PATH = BASE_DIR / PACKAGE_NAME / "__about__.py"
|
|
|
|
with open(str(SOURCE_METADATA_PATH.resolve())) as f:
|
2018-11-04 13:07:02 +00:00
|
|
|
exec(f.read(), ABOUT)
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Utilities
|
|
|
|
#
|
|
|
|
|
|
|
|
class VerifyVersionCommand(install):
|
|
|
|
"""Custom command to verify that the git tag matches our version"""
|
|
|
|
description = 'verify that the git tag matches our version'
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
tag = os.getenv('CIRCLE_TAG')
|
|
|
|
if tag.startswith('v'):
|
|
|
|
tag = tag[1:]
|
|
|
|
|
|
|
|
version = ABOUT['__version__']
|
|
|
|
if version.startswith('v'):
|
|
|
|
version = version[1:]
|
|
|
|
|
|
|
|
if tag != version:
|
|
|
|
info = "Git tag: {0} does not match the version of this app: {1}".format(
|
|
|
|
os.getenv('CIRCLE_TAG'), ABOUT['__version__']
|
|
|
|
)
|
|
|
|
sys.exit(info)
|
|
|
|
|
|
|
|
|
2020-04-24 17:52:27 +00:00
|
|
|
class PostDevelopCommand(develop):
|
|
|
|
"""
|
|
|
|
Post-installation for development mode.
|
|
|
|
Execute manually with python setup.py develop or automatically included with
|
2020-04-28 18:19:25 +00:00
|
|
|
`pip install -e . -r dev-requirements.txt`.
|
2020-04-24 17:52:27 +00:00
|
|
|
"""
|
2023-08-25 00:17:05 +00:00
|
|
|
|
2020-04-24 17:52:27 +00:00
|
|
|
def run(self):
|
2020-05-28 18:53:54 +00:00
|
|
|
"""development setup scripts (pre-requirements)"""
|
2020-04-24 17:52:27 +00:00
|
|
|
develop.run(self)
|
|
|
|
|
2020-06-26 02:52:04 +00:00
|
|
|
|
2018-11-04 13:07:02 +00:00
|
|
|
#
|
2020-04-25 02:16:18 +00:00
|
|
|
# Requirements
|
2018-11-04 13:07:02 +00:00
|
|
|
#
|
|
|
|
|
2020-04-24 19:00:46 +00:00
|
|
|
def read_requirements(path):
|
2021-05-11 17:55:13 +00:00
|
|
|
with open(BASE_DIR / path) as f:
|
2020-12-20 09:27:59 +00:00
|
|
|
_pipenv_flags, *lines = f.read().split('\n')
|
|
|
|
|
2020-12-24 11:38:14 +00:00
|
|
|
# TODO remove when will be no more git dependencies in requirements.txt
|
2020-12-20 09:27:59 +00:00
|
|
|
# Transforms VCS requirements to PEP 508
|
|
|
|
requirements = []
|
|
|
|
for line in lines:
|
|
|
|
if line.startswith('-e git:') or line.startswith('-e git+') or \
|
|
|
|
line.startswith('git:') or line.startswith('git+'):
|
|
|
|
# parse out egg=... fragment from VCS URL
|
|
|
|
parsed = urlparse(line)
|
|
|
|
egg_name = parsed.fragment.partition("egg=")[-1]
|
|
|
|
without_fragment = parsed._replace(fragment="").geturl()
|
|
|
|
requirements.append(f"{egg_name} @ {without_fragment}")
|
|
|
|
else:
|
|
|
|
requirements.append(line)
|
|
|
|
|
2020-05-21 05:32:01 +00:00
|
|
|
return requirements
|
2020-04-24 19:00:46 +00:00
|
|
|
|
|
|
|
|
2023-06-07 15:07:00 +00:00
|
|
|
INSTALL_REQUIRES = read_requirements("requirements.txt")
|
|
|
|
DEV_REQUIRES = read_requirements("dev-requirements.txt")
|
2022-05-02 11:10:55 +00:00
|
|
|
|
2020-04-24 19:00:46 +00:00
|
|
|
BENCHMARK_REQUIRES = [
|
|
|
|
'pytest-benchmark'
|
|
|
|
]
|
|
|
|
|
|
|
|
DEPLOY_REQUIRES = [
|
|
|
|
'bumpversion',
|
2020-04-25 02:16:18 +00:00
|
|
|
'ansible',
|
2021-12-14 00:30:28 +00:00
|
|
|
'twine',
|
|
|
|
'wheel'
|
2020-04-24 19:00:46 +00:00
|
|
|
]
|
|
|
|
|
2023-09-22 09:51:37 +00:00
|
|
|
URSULA_REQUIRES = ["sentry-sdk"]
|
2020-04-27 18:32:15 +00:00
|
|
|
|
2020-04-24 19:00:46 +00:00
|
|
|
EXTRAS = {
|
2020-05-26 21:00:42 +00:00
|
|
|
|
|
|
|
# Admin
|
2023-06-07 15:07:00 +00:00
|
|
|
"dev": DEV_REQUIRES + URSULA_REQUIRES,
|
|
|
|
"benchmark": DEV_REQUIRES + BENCHMARK_REQUIRES,
|
|
|
|
"deploy": DEPLOY_REQUIRES,
|
|
|
|
"ursula": URSULA_REQUIRES,
|
2020-04-24 19:00:46 +00:00
|
|
|
}
|
|
|
|
|
2020-04-24 17:52:27 +00:00
|
|
|
setup(
|
|
|
|
|
|
|
|
# Requirements
|
|
|
|
python_requires='>=3',
|
|
|
|
install_requires=INSTALL_REQUIRES,
|
2020-04-24 19:00:46 +00:00
|
|
|
extras_require=EXTRAS,
|
2020-04-24 17:52:27 +00:00
|
|
|
|
|
|
|
# Package Data
|
2022-10-29 12:23:50 +00:00
|
|
|
packages=find_packages(exclude=["scripts"]),
|
2020-04-24 17:52:27 +00:00
|
|
|
include_package_data=True,
|
|
|
|
zip_safe=False,
|
|
|
|
|
|
|
|
# Entry Points
|
2022-10-29 12:23:50 +00:00
|
|
|
entry_points={
|
|
|
|
'console_scripts': [
|
|
|
|
'nucypher = nucypher.cli.main:nucypher_cli',
|
|
|
|
],
|
|
|
|
'pytest11': [
|
|
|
|
"pytest-nucypher = tests.fixtures"
|
|
|
|
]
|
|
|
|
},
|
2020-04-24 17:52:27 +00:00
|
|
|
|
2020-04-28 18:19:25 +00:00
|
|
|
# setup.py commands
|
2020-04-25 02:16:18 +00:00
|
|
|
cmdclass={
|
|
|
|
'verify': VerifyVersionCommand,
|
|
|
|
'develop': PostDevelopCommand
|
|
|
|
},
|
2020-04-24 17:52:27 +00:00
|
|
|
|
|
|
|
# Metadata
|
|
|
|
name=ABOUT['__title__'],
|
|
|
|
url=ABOUT['__url__'],
|
|
|
|
version=ABOUT['__version__'],
|
|
|
|
author=ABOUT['__author__'],
|
|
|
|
author_email=ABOUT['__email__'],
|
|
|
|
description=ABOUT['__summary__'],
|
|
|
|
license=ABOUT['__license__'],
|
|
|
|
long_description_content_type="text/markdown",
|
|
|
|
long_description_markdown_filename='README.md',
|
|
|
|
keywords="nucypher, proxy re-encryption",
|
|
|
|
classifiers=PYPI_CLASSIFIERS
|
|
|
|
)
|