2019-08-29 20:56:25 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2014-01-12 15:35:31 +00:00
|
|
|
DESCRIPTION = """\
|
2020-12-22 18:25:06 +00:00
|
|
|
PyQtGraph is a pure-python graphics and GUI library built on PyQt5/PySide2 and
|
2014-01-12 15:35:31 +00:00
|
|
|
numpy.
|
2012-09-13 14:12:59 +00:00
|
|
|
|
2014-01-12 15:35:31 +00:00
|
|
|
It is intended for use in mathematics / scientific / engineering applications.
|
|
|
|
Despite being written entirely in python, the library is very fast due to its
|
|
|
|
heavy leverage of numpy for number crunching, Qt's GraphicsView framework for
|
|
|
|
2D display, and OpenGL for 3D display.
|
|
|
|
"""
|
2012-09-10 22:00:59 +00:00
|
|
|
|
2014-01-12 15:35:31 +00:00
|
|
|
setupOpts = dict(
|
|
|
|
name='pyqtgraph',
|
|
|
|
description='Scientific Graphics and GUI Library for Python',
|
|
|
|
long_description=DESCRIPTION,
|
2019-08-29 20:56:25 +00:00
|
|
|
license = 'MIT',
|
2014-01-12 15:35:31 +00:00
|
|
|
url='http://www.pyqtgraph.org',
|
|
|
|
author='Luke Campagnola',
|
|
|
|
author_email='luke.campagnola@gmail.com',
|
|
|
|
classifiers = [
|
|
|
|
"Programming Language :: Python",
|
|
|
|
"Programming Language :: Python :: 3",
|
|
|
|
"Development Status :: 4 - Beta",
|
|
|
|
"Environment :: Other Environment",
|
|
|
|
"Intended Audience :: Science/Research",
|
|
|
|
"License :: OSI Approved :: MIT License",
|
|
|
|
"Operating System :: OS Independent",
|
|
|
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
|
|
"Topic :: Scientific/Engineering :: Visualization",
|
|
|
|
"Topic :: Software Development :: User Interfaces",
|
|
|
|
],
|
|
|
|
)
|
2012-12-27 04:35:23 +00:00
|
|
|
|
|
|
|
|
2014-01-12 15:35:31 +00:00
|
|
|
import distutils.dir_util
|
2014-12-24 17:06:40 +00:00
|
|
|
from distutils.command import build
|
2014-01-12 15:35:31 +00:00
|
|
|
import os, sys, re
|
2014-01-23 18:28:30 +00:00
|
|
|
try:
|
|
|
|
import setuptools
|
2014-12-24 16:19:42 +00:00
|
|
|
from setuptools import setup
|
|
|
|
from setuptools.command import install
|
2014-01-23 18:28:30 +00:00
|
|
|
except ImportError:
|
2016-10-18 15:47:38 +00:00
|
|
|
sys.stderr.write("Warning: could not import setuptools; falling back to distutils.\n")
|
2014-12-24 16:19:42 +00:00
|
|
|
from distutils.core import setup
|
|
|
|
from distutils.command import install
|
|
|
|
|
2013-12-01 15:23:45 +00:00
|
|
|
|
2016-10-15 01:36:39 +00:00
|
|
|
# Work around mbcs bug in distutils.
|
|
|
|
# http://bugs.python.org/issue10945
|
|
|
|
import codecs
|
|
|
|
try:
|
|
|
|
codecs.lookup('mbcs')
|
|
|
|
except LookupError:
|
|
|
|
ascii = codecs.lookup('ascii')
|
|
|
|
func = lambda name, enc=ascii: {True: enc}.get(name=='mbcs')
|
|
|
|
codecs.register(func)
|
|
|
|
|
|
|
|
|
2014-01-12 15:35:31 +00:00
|
|
|
path = os.path.split(__file__)[0]
|
|
|
|
sys.path.insert(0, os.path.join(path, 'tools'))
|
|
|
|
import setupHelpers as helpers
|
2013-12-01 15:23:45 +00:00
|
|
|
|
2014-01-12 15:35:31 +00:00
|
|
|
## generate list of all sub-packages
|
2014-12-22 23:29:09 +00:00
|
|
|
allPackages = (helpers.listAllPackages(pkgroot='pyqtgraph') +
|
|
|
|
['pyqtgraph.'+x for x in helpers.listAllPackages(pkgroot='examples')])
|
2014-01-12 15:35:31 +00:00
|
|
|
|
|
|
|
## Decide what version string to use in the build
|
|
|
|
version, forcedVersion, gitVersion, initVersion = helpers.getVersionStrings(pkg='pyqtgraph')
|
2013-12-01 15:23:45 +00:00
|
|
|
|
|
|
|
|
2013-12-15 18:01:37 +00:00
|
|
|
|
2014-12-24 16:19:42 +00:00
|
|
|
class Build(build.build):
|
2014-01-12 15:35:31 +00:00
|
|
|
"""
|
|
|
|
* Clear build path before building
|
|
|
|
"""
|
2013-12-15 18:01:37 +00:00
|
|
|
def run(self):
|
2016-10-15 01:36:39 +00:00
|
|
|
global path
|
2014-01-12 16:50:52 +00:00
|
|
|
|
2014-01-12 15:35:31 +00:00
|
|
|
## Make sure build directory is clean
|
|
|
|
buildPath = os.path.join(path, self.build_lib)
|
|
|
|
if os.path.isdir(buildPath):
|
|
|
|
distutils.dir_util.remove_tree(buildPath)
|
|
|
|
|
2014-12-24 16:19:42 +00:00
|
|
|
ret = build.build.run(self)
|
2013-12-15 18:01:37 +00:00
|
|
|
|
2016-10-15 01:36:39 +00:00
|
|
|
|
|
|
|
class Install(install.install):
|
|
|
|
"""
|
|
|
|
* Check for previously-installed version before installing
|
|
|
|
* Set version string in __init__ after building. This helps to ensure that we
|
|
|
|
know when an installation came from a non-release code base.
|
|
|
|
"""
|
|
|
|
def run(self):
|
|
|
|
global path, version, initVersion, forcedVersion, installVersion
|
|
|
|
|
|
|
|
name = self.config_vars['dist_name']
|
|
|
|
path = os.path.join(self.install_libbase, 'pyqtgraph')
|
|
|
|
if os.path.exists(path):
|
|
|
|
raise Exception("It appears another version of %s is already "
|
|
|
|
"installed at %s; remove this before installing."
|
|
|
|
% (name, path))
|
|
|
|
print("Installing to %s" % path)
|
|
|
|
rval = install.install.run(self)
|
|
|
|
|
|
|
|
|
2013-12-15 18:01:37 +00:00
|
|
|
# If the version in __init__ is different from the automatically-generated
|
2016-10-17 16:17:33 +00:00
|
|
|
# version string, then we will update __init__ in the install directory
|
2013-12-15 18:01:37 +00:00
|
|
|
if initVersion == version:
|
2016-10-17 16:17:33 +00:00
|
|
|
return rval
|
2013-12-15 18:01:37 +00:00
|
|
|
|
2014-01-12 15:35:31 +00:00
|
|
|
try:
|
2016-10-15 01:36:39 +00:00
|
|
|
initfile = os.path.join(path, '__init__.py')
|
2013-12-15 18:17:26 +00:00
|
|
|
data = open(initfile, 'r').read()
|
|
|
|
open(initfile, 'w').write(re.sub(r"__version__ = .*", "__version__ = '%s'" % version, data))
|
2016-10-15 01:36:39 +00:00
|
|
|
installVersion = version
|
2014-01-12 15:35:31 +00:00
|
|
|
except:
|
|
|
|
sys.stderr.write("Warning: Error occurred while setting version string in build path. "
|
|
|
|
"Installation will use the original version string "
|
|
|
|
"%s instead.\n" % (initVersion)
|
|
|
|
)
|
2016-10-15 01:36:39 +00:00
|
|
|
if forcedVersion:
|
|
|
|
raise
|
|
|
|
installVersion = initVersion
|
2014-01-12 15:35:31 +00:00
|
|
|
sys.excepthook(*sys.exc_info())
|
2016-10-15 01:36:39 +00:00
|
|
|
|
|
|
|
return rval
|
2013-12-15 18:01:37 +00:00
|
|
|
|
2014-12-24 16:19:42 +00:00
|
|
|
|
2014-01-12 15:35:31 +00:00
|
|
|
setup(
|
|
|
|
version=version,
|
2014-03-30 06:51:32 +00:00
|
|
|
cmdclass={'build': Build,
|
|
|
|
'install': Install,
|
|
|
|
'deb': helpers.DebCommand,
|
|
|
|
'test': helpers.TestCommand,
|
|
|
|
'debug': helpers.DebugCommand,
|
2014-04-03 20:56:17 +00:00
|
|
|
'mergetest': helpers.MergeTestCommand,
|
2014-03-30 06:51:32 +00:00
|
|
|
'style': helpers.StyleCommand},
|
2014-01-12 15:35:31 +00:00
|
|
|
packages=allPackages,
|
2020-12-22 18:25:06 +00:00
|
|
|
python_requires=">=3.7",
|
2012-12-26 22:51:52 +00:00
|
|
|
package_dir={'pyqtgraph.examples': 'examples'}, ## install examples along with the rest of the source
|
2014-12-23 21:39:37 +00:00
|
|
|
package_data={'pyqtgraph.examples': ['optics/*.gz', 'relativity/presets/*.cfg']},
|
2012-12-27 15:31:08 +00:00
|
|
|
install_requires = [
|
2020-12-22 18:25:06 +00:00
|
|
|
'numpy>=1.17.0',
|
2012-12-26 22:51:52 +00:00
|
|
|
],
|
2014-01-12 15:35:31 +00:00
|
|
|
**setupOpts
|
2012-09-10 22:00:59 +00:00
|
|
|
)
|