forked from cbrnr/mnelab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
96 lines (83 loc) · 2.84 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Authors: Clemens Brunner <clemens.brunner@gmail.com>
#
# License: BSD (3-clause)
from setuptools import setup, find_packages
from os import path
from importlib import import_module
def optdep(*args):
"""Manage optional dependencies.
Parameters
----------
*args : str
Module names to check if they are installed.
Returns
-------
pkg : str | None
Package name that should be added to requires so that it will be
installed automatically. If any package in *args is installed, this
will return None. Otherwise, if no package is installed this will
return the first package in *args.
"""
for dep in args:
try:
import_module(dep)
except ImportError:
continue
return
return args[0]
here = path.abspath(path.dirname(__file__))
# get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
# get the version (without importing)
with open(path.join('mnelab', 'mainwindow.py'), 'r') as f:
for line in f:
if line.strip().startswith('__version__'):
version = line.split('=')[1].strip().strip('"')
break
# get install requirements
with open(path.join(here, "requirements.txt")) as f:
requires = f.read().splitlines()
# check if either PySide2 or PyQt5 is installed; if not add PySide2 to requires
qtpkg = optdep("PySide2", "PyQt5")
if qtpkg is not None:
requires.append(qtpkg)
# get extra (optional) requirements
extras_require = {}
with open(path.join(here, "requirements-extras.txt")) as f:
for extra in f:
package, text = extra.split("#")
extras_require[text.strip()] = [package.strip()]
setup(
name='mnelab',
version=version,
description='A graphical user interface for MNE',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/cbrnr/mnelab',
author='Clemens Brunner',
author_email='clemens.brunner@gmail.com',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Science/Research',
'Topic :: Scientific/Engineering',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9'
],
keywords='EEG MEG MNE GUI electrophysiology',
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
python_requires='>=3.6, <4',
install_requires=requires,
extras_require=extras_require,
license="BSD-3-Clause",
include_package_data=True,
entry_points={
'gui_scripts': [
'mnelab=mnelab.__main__:main',
],
}
)