-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathsetup.py
More file actions
136 lines (115 loc) · 4.78 KB
/
setup.py
File metadata and controls
136 lines (115 loc) · 4.78 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# -*- coding: utf-8 -*-
#
# Licensed under the terms of the MIT License
# Copyright (c) 2015 Pierre Raybaut
# (see LICENSE file for more details)
"""
PythonQwt
=========
Qt plotting widgets for Python
"""
from __future__ import print_function
import os
import sys
import os.path as osp
import setuptools # analysis:ignore
from distutils.core import setup
from distutils.command.build import build
LIBNAME = 'PythonQwt'
PACKAGE_NAME = 'qwt'
from qwt import __version__ as version
DESCRIPTION = 'Qt plotting widgets for Python'
LONG_DESCRIPTION = """\
The ``PythonQwt`` project was initiated to solve -at least temporarily- the
obsolescence issue of `PyQwt` (the Python-Qwt C++ bindings library) which is
no longer maintained. The idea was to translate the original Qwt C++ code to
Python and then to optimize some parts of the code by writing new modules
based on NumPy and other libraries.
The ``PythonQwt`` package consists of a single Python package named `qwt`
which is a pure Python implementation of Qwt C++ library with some
limitations: efforts were concentrated on basic plotting features, leaving
higher level features to the `guiqwt` library."""
KEYWORDS = ''
CLASSIFIERS = []
if 'beta' in version or 'b' in version:
CLASSIFIERS += ['Development Status :: 4 - Beta']
elif 'alpha' in version or 'a' in version or version.startswith('0.'):
CLASSIFIERS += ['Development Status :: 3 - Alpha']
else:
CLASSIFIERS += ['Development Status :: 5 - Production/Stable']
if os.name == 'nt':
SCRIPTS = ['PythonQwt-tests', 'PythonQwt-tests.bat']
else:
SCRIPTS = ['PythonQwt-tests']
SCRIPTS = [osp.join('scripts', fname) for fname in SCRIPTS]
def get_package_data(name, extlist):
"""Return data files for package *name* with extensions in *extlist*"""
flist = []
# Workaround to replace os.path.relpath (not available until Python 2.6):
offset = len(name)+len(os.pathsep)
for dirpath, _dirnames, filenames in os.walk(name):
for fname in filenames:
if not fname.startswith('.') and osp.splitext(fname)[1] in extlist:
flist.append(osp.join(dirpath, fname)[offset:])
return flist
def get_subpackages(name):
"""Return subpackages of package *name*"""
splist = []
for dirpath, _dirnames, _filenames in os.walk(name):
if osp.isfile(osp.join(dirpath, '__init__.py')):
splist.append(".".join(dirpath.split(os.sep)))
return splist
try:
import sphinx
except ImportError:
sphinx = None
from distutils.command.build import build as dftbuild
class build(dftbuild):
def has_doc(self):
if sphinx is None:
return False
setup_dir = os.path.dirname(os.path.abspath(__file__))
return os.path.isdir(os.path.join(setup_dir, 'doc'))
sub_commands = dftbuild.sub_commands + [('build_doc', has_doc)]
cmdclass = {'build' : build}
if sphinx:
from sphinx.setup_command import BuildDoc
class build_doc(BuildDoc):
def run(self):
# make sure the python path is pointing to the newly built
# code so that the documentation is built on this and not a
# previously installed version
build = self.get_finalized_command('build')
sys.path.insert(0, os.path.abspath(build.build_lib))
try:
sphinx.setup_command.BuildDoc.run(self)
except UnicodeDecodeError:
print("ERROR: unable to build documentation because Sphinx do not handle source path with non-ASCII characters. Please try to move the source package to another location (path with *only* ASCII characters).", file=sys.stderr)
sys.path.pop(0)
cmdclass['build_doc'] = build_doc
setup(name=LIBNAME, version=version,
description=DESCRIPTION, long_description=LONG_DESCRIPTION,
packages=get_subpackages(PACKAGE_NAME),
package_data={PACKAGE_NAME:
get_package_data(PACKAGE_NAME, ('.png', '.svg', '.mo'))},
requires=["PyQt4 (>4.3)",],
scripts=SCRIPTS,
author = "Pierre Raybaut",
author_email = '[email protected]',
url = 'https://github.com/PierreRaybaut/%s' % LIBNAME,
platforms = 'Any',
classifiers=CLASSIFIERS + [
'License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)',
'License :: OSI Approved :: MIT License',
'Topic :: Scientific/Engineering :: Visualization',
'Topic :: Software Development :: Widget Sets',
'Operating System :: MacOS',
'Operating System :: Microsoft :: Windows',
'Operating System :: OS Independent',
'Operating System :: POSIX',
'Operating System :: Unix',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
],
cmdclass=cmdclass)