-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
55 lines (49 loc) · 1.88 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
################################################################################
# Copyright 2022-2023 Lawrence Livermore National Security, LLC and other
# LEAP project developers. See the LICENSE file for details.
# SPDX-License-Identifier: MIT
#
# LivermorE AI Projector for Computed Tomography (LEAP)
# setup.py for pytorch module
################################################################################
import os
import pathlib
import sys
from setuptools import setup, find_packages
from setuptools.command.install import install
from sys import platform as _platform
if _platform == "linux" or _platform == "linux2":
lib_fname = 'build/lib/libxrayphysics.so'
retVal = os.system(r'sh ./etc/build.sh')
if retVal != 0:
print('Failed to compile!')
quit()
elif _platform == "win32":
lib_fname = r'win_build\bin\Release\libxrayphysics.dll'
retVal = os.system(r'.\etc\win_build_agn.bat')
if retVal != 0:
print('Failed to compile!')
quit()
import site
copy_text = 'copy ' + str(lib_fname) + ' ' + str(os.path.join(site.getsitepackages()[1], 'libxrayphysics.dll'))
os.system(copy_text)
elif _platform == "darwin":
lib_fname = 'build/lib/libxrayphysics.dylib'
retVal = os.system(r'sh ./etc/build.sh')
if retVal != 0:
print('Failed to compile!')
quit()
setup(
name='xrayphysics',
version='1.2',
author='Kyle Champley',
author_email='[email protected]',
description='x-ray cross section tables, x-ray tube source simulation, beam hardening correction, and dual energy decompositon',
keywords='x-ray-physics, spectra, cross-sections, beamhardening, bremsstrahlung, x-ray-simulation',
python_requires='>=3.6',
packages=find_packages("src"),
package_dir={'': 'src'},
install_requires=['numpy'],
py_modules=['xrayphysics'],
package_data={'': [lib_fname]},
)