-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
57 lines (50 loc) · 2.3 KB
/
setup.py
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
## -*- encoding: utf-8 -*-
import os
import sys
import re
from setuptools import setup
from codecs import open # To open the README file with proper encoding
from setuptools.command.test import test as TestCommand # for tests
from distutils.command import build as build_module
# Get information from separate files (README, VERSION)
def readfile(filename):
with open(filename, encoding='utf-8') as f:
return f.read()
# Check the right Sage version
class build(build_module.build):
def run(self):
from sagemath.check_version import check_version
check_version(sage_required_version)
build_module.build.run(self)
# For the tests
class SageTest(TestCommand):
def run_tests(self):
# errno = os.system("sage -t --force-lib cn_hyperarr cn_hyperarr/*.pyx")
errno = os.system("sage -t --force-lib cn_hyperarr")
if errno != 0:
sys.exit(1)
from sage.misc.banner import version as sage_version
# Specify the required Sage version
sage_required_version = '>=9.2'
sage_current_version = sage_version()
py2 = bool('8.' in sage_current_version or '7.' in sage_current_version)
REQUIREMENTS = [i.strip() for i in open("requirements.txt").readlines() if i[0] != '#']
CLASSIFIERS = [i.strip() for i in open("classifiers.txt").readlines() if i[0] != '#']
setup(
name = "cn_hyperarr",
version = readfile("VERSION"), # the VERSION file is shared with the documentation
description='Computation of congruence normality for hyperplane arrangements',
long_description = readfile("README.rst"), # get the long description from the README
url='https://github.com/sophiasage/cn_hyperarr',
author='Sophia Elia',
author_email='sophiae56@zedat.fu-berlin.de', # choose a main contact email
license="GNU General Public License v3",
classifiers = CLASSIFIERS,
keywords = "SageMath packaging",
# setup_requires = REQUIREMENTS, # currently useless, see https://www.python.org/dev/peps/pep-0518/
install_requires = REQUIREMENTS, # This ensures that Sage is installed
packages = ['cn_hyperarr'],
# ext_modules = cythonize(ext_modules) if py2 else cythonize(ext_modules, compiler_directives={'language_level' : "3"}),
include_package_data = True,
cmdclass = {'build': build, 'test': SageTest} # adding a special setup command for tests
)