-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
106 lines (89 loc) · 3.39 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
# -*- coding: utf-8 -*-
# !/usr/bin/env python
"""
Setup for SasData
"""
import os
import shutil
import sys
from distutils.core import Command
from setuptools import setup
# Manage version number ######################################
with open(os.path.join("sasdata", "__init__.py")) as fid:
for line in fid:
if line.startswith('__version__'):
print(line)
VERSION = line.split('"')[1]
break
else:
raise ValueError("Could not find version in sasdata/__init__.py")
##############################################################
package_dir = {}
package_data = {}
packages = []
# Remove all files that should be updated by this setup
# We do this here because application updates these files from .sasdata
# except when there is no such file
CURRENT_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
SAS_DATA_BUILD = os.path.join(CURRENT_SCRIPT_DIR, "build")
# Optionally clean before build.
dont_clean = 'update' in sys.argv
if dont_clean:
sys.argv.remove('update')
elif os.path.exists(SAS_DATA_BUILD):
print("Removing existing build directory", SAS_DATA_BUILD, "for a clean build")
shutil.rmtree(SAS_DATA_BUILD)
# _standard_ commands which should trigger the Qt build
build_commands = [
'install', 'build', 'build_py', 'bdist', 'bdist_egg', 'bdist_rpm',
'bdist_wheel', 'develop', 'test'
]
# sasdata module
package_dir["sasdata"] = os.path.join("sasdata")
packages.append("sasdata")
# sasdata.dataloader
package_dir["sasdata.dataloader"] = os.path.join("sasdata", "dataloader")
package_data["sasdata.dataloader.readers"] = ['schema/*.xsd']
packages.extend(["sasdata.dataloader", "sasdata.dataloader.readers", "sasdata.dataloader.readers.schema"])
# sasdata.file_converter
package_dir["sasdata.file_converter"] = os.path.join("sasdata", "file_converter")
packages.append("sasdata.file_converter")
# sasdata.data_util
package_dir["sasdata.data_util"] = os.path.join("sasdata", "data_util")
packages.append("sasdata.data_util")
# sasdata.example_data
package_dir["sasdata.example_data"] = os.path.join('sasdata', 'example_data')
package_data["sasdata.example_data"] = ['1d_data/*.*',
'2d_data/*.*',
'convertible_files/*.*',
'dls_data/*.*',
'image_data/*.*',
'media/*.*',
'nr_data/*.*',
'other_files/*.*',
'sesans_data/*.*']
packages.append("sasdata.example_data")
required = ['lxml', 'h5py', 'numpy']
with open('LICENSE.TXT', encoding='utf-8') as f:
license_text = f.read()
with open('README.md', encoding='utf-8') as f:
long_description = f.read()
# Set up SasView
setup(
name="sasdata",
version=VERSION,
description="Sas Data Loader application",
long_description=long_description,
long_description_content_type='text/markdown',
author="SasView Team",
author_email="[email protected]",
url="https://sasview.org",
license=license_text,
keywords="small-angle x-ray and neutron scattering data loading",
download_url="https://github.com/SasView/sasdata.git",
package_dir=package_dir,
packages=packages,
package_data=package_data,
install_requires=required,
zip_safe=False
)