setup.py 4.4 KB
Newer Older
1 2
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
3 4 5
import os
from glob import glob
from os.path import splitext, basename
6

Benoit Martin's avatar
Benoit Martin committed
7 8
from setuptools import setup, find_packages

Benoit Martin's avatar
Benoit Martin committed
9
from src import __version__
10

Benoit Martin's avatar
Benoit Martin committed
11

12 13
try:  # for pip >= 10
    from pip._internal.req import parse_requirements
14
except ImportError:  # for pip <= 9.0.3
15 16 17
    from pip.req import parse_requirements


18 19 20 21 22 23 24 25 26 27 28 29 30
def str_to_bool(s):
    if s is None:
        return False

    assert isinstance(s, str), 'given argument must be a string'
    if s.lower() in ['true', '1', 'yes']:
        return True
    elif s.lower() in ['false', '0', 'no']:
        return False
    else:
        raise LookupError


Benoit Martin's avatar
Benoit Martin committed
31 32 33
# build gui by default
build_gui = str_to_bool(os.environ['BUILD_GUI']) if 'BUILD_GUI' in os.environ else True

34
print('Building Deformetrica version ' + __version__ + ', BUILD_GUI=' + str(build_gui))
35 36


37
def build_deformetrica():
38
    print('build_deformetrica()')
39 40
    setup(
        name='deformetrica',
Benoit Martin's avatar
Benoit Martin committed
41
        version=__version__,
42 43 44 45 46 47 48
        url='http://www.deformetrica.org',
        description='Software for the statistical analysis of 2D and 3D shape data.',
        long_description=open('README.md', encoding='utf-8').read(),
        author='ARAMIS Lab',
        maintainer='Deformetrica developers',
        maintainer_email='deformetrica.team@gmail.com',
        license='INRIA license',
Benoit Martin's avatar
Benoit Martin committed
49
        package_dir={'': 'src'},
50
        packages=find_packages('src', exclude=['build*', 'examples*', 'output*', 'sandbox*', 'utilities*', 'tests*', '.*']),
Benoit Martin's avatar
Benoit Martin committed
51
        py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
52
        package_data={'': ['*.json', '*.png']},
53
        include_package_data=True,
54
        # data_files=[('', ['LICENSE.txt'])],
55 56 57 58 59 60
        zip_safe=False,
        entry_points={
            'console_scripts': ['deformetrica=deformetrica:main'],  # CLI
        },
        classifiers=[
            'Framework :: Deformetrica',
Benoit Martin's avatar
Benoit Martin committed
61
            'Development Status :: ' + __version__,
62
            'Environment :: Console',
63
            'Environment :: X11 Applications :: Qt',
64 65 66
            'Operating System :: OS Independent',
            'Programming Language :: Python',
            'Programming Language :: Python :: 3',
67
            'Programming Language :: Python :: 3.5',
68
            'Programming Language :: Python :: 3.6',
Benoit Martin's avatar
Benoit Martin committed
69 70 71
            'Topic :: Scientific/Engineering',
            'Topic :: Scientific/Engineering :: Bio-Informatics',
            'Topic :: Software Development :: Libraries'
72 73
        ],
        install_requires=[
74
            'pykeops==1.0.1',
Benoit Martin's avatar
Benoit Martin committed
75 76
            'gputil>=1.3',
            # 'PyQt5>=5.11',
77
        ],
Benoit Martin's avatar
Benoit Martin committed
78
        extra_link_args=['-Wl,-headerpad_max_install_names']
79 80 81
    )


82
def build_deformetrica_nox():
83
    print('build_deformetrica_nox()')
84
    setup(
85
        name='deformetrica-nox',
Benoit Martin's avatar
Benoit Martin committed
86
        version=__version__,
87 88 89 90 91 92 93
        url='http://www.deformetrica.org',
        description='Software for the statistical analysis of 2D and 3D shape data.',
        long_description=open('README.md', encoding='utf-8').read(),
        author='ARAMIS Lab',
        maintainer='Deformetrica developers',
        maintainer_email='deformetrica.team@gmail.com',
        license='INRIA license',
Benoit Martin's avatar
Benoit Martin committed
94
        package_dir={'': 'src'},
95
        packages=find_packages('src', exclude=['gui*', 'build*', 'examples*', 'output*', 'sandbox*', 'utilities*', 'tests*', '.*']),  # exclude gui
Benoit Martin's avatar
Benoit Martin committed
96
        py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
97 98
        # py_modules=['.', 'src'],
        # data_files=[('src', ['LICENSE.txt'])],
99 100 101
        include_package_data=True,
        zip_safe=False,
        entry_points={
Benoit Martin's avatar
Benoit Martin committed
102
            'console_scripts': ['deformetrica=deformetrica:main'],  # CLI
103 104 105
        },
        classifiers=[
            'Framework :: Deformetrica',
Benoit Martin's avatar
Benoit Martin committed
106
            'Development Status :: ' + __version__,
107 108 109 110
            'Environment :: Console',
            'Operating System :: OS Independent',
            'Programming Language :: Python',
            'Programming Language :: Python :: 3',
111
            'Programming Language :: Python :: 3.5',
112
            'Programming Language :: Python :: 3.6',
Benoit Martin's avatar
Benoit Martin committed
113 114 115
            'Topic :: Scientific/Engineering',
            'Topic :: Scientific/Engineering :: Bio-Informatics',
            'Topic :: Software Development :: Libraries'
116 117
        ],
        install_requires=[
118
            'pykeops==1.0.1',
Benoit Martin's avatar
Benoit Martin committed
119
            'gputil>=1.3',
120
        ],
Benoit Martin's avatar
Benoit Martin committed
121
        extra_link_args=['-Wl,-headerpad_max_install_names']
122 123 124 125 126
    )


if build_gui:
    build_deformetrica()
127 128
else:
    build_deformetrica_nox()