forked from SophieTh/und_Sophie_2016
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
114 lines (97 loc) · 3.74 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2016 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# ###########################################################################*/
#
# Memorandum:
#
# Install from sources:
# git clone https://github.com/SophieTh/und_Sophie_2016.git pySRU
# cd pySRU
# python setup.py install
#
# Upload to pypi (when uploading, increment the version number):
# python setup.py register (only once, not longer needed)
# python setup.py sdist
# python setup.py upload
#
# Install from pypi:
# pip install pySRU
#
__authors__ = ["S Thery, M Glass, M Sanchez del Rio - ESRF ISDD Advanced Analysis and Modelling"]
__license__ = "MIT"
__date__ = "31/08/2016"
from setuptools import setup, Command
import sys
import os
cmdclass = {}
# create doc with sphinx: python setup.py build_doc
try:
import sphinx
import sphinx.util.console
sphinx.util.console.color_terminal = lambda: False
from sphinx.setup_command import BuildDoc
except ImportError:
sphinx = None
class SphinxExpectedCommand(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
raise RuntimeError(
'Sphinx is required to build or test the documentation.\n'
'Please install Sphinx (http://www.sphinx-doc.org).')
if sphinx is not None:
class BuildDocCommand(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))
# Build the Users Guide in HTML and TeX format
for builder in ['html', 'latex']:
self.builder = builder
self.builder_target_dir = os.path.join(self.build_dir, builder)
self.mkpath(self.builder_target_dir)
BuildDoc.run(self)
sys.path.pop(0)
else:
BuildDocCommand = SphinxExpectedCommand
cmdclass['build_doc'] = BuildDocCommand
setup(name='pySRU',
version='0.5.3',
description='Python synchrotron undulator calcution',
author='Sophie Thery, Mark Glass, Manuel Sanchez del Rio',
author_email='srio@esrf.eu',
url='https://github.com/SophieTh/und_Sophie_2016/',
packages=['pySRU'],
install_requires=[
'numpy',
'scipy'
],
cmdclass=cmdclass,
test_suite='tests'
)