Newer
Older
from setuptools import setup
from setuptools.command.install import install
from subprocess import check_call, check_output
from distutils.command.build import build
from Cython.Distutils import build_ext
from distutils.extension import Extension
extensions = [Extension("cal_tools.cython.agipdalgs",
['cal_tools/cython/agipdalgs.pyx'],
include_dirs=[numpy.get_include()],
extra_compile_args=['-fopenmp', '-march=native'],
extra_link_args=['-fopenmp'], ),
]
class PostInstallCommand(install):
"""Post-installation for installation mode."""
def run(self):
# check if this is a karabo installation
python_path = sys.executable
if "karabo" in python_path:
print("Karabo installation detected, checking for PyDetLib installation")
try:
import XFELDetAna
print("...found!")
return
except:
check_call("karabo -g https://in.xfel.eu/gitlab install pyDetLib master".split())
else:
print("Python environment seems to not be a Karabo environment. "+
class PreInstallCommand(build):
"""Pre-installation for installation mode."""
def run(self):
version = check_output(['git', 'describe', '--tag']).decode('utf8')
version = version.replace("\n", "")
file = open('xfel_calibrate/VERSION.py', 'w')
file.write('__version__="{}"'.format(version))
file.close()
build.run(self)
from xfel_calibrate.notebooks import notebooks
data_files = []
for ctypes in notebooks.values():
for nb in ctypes.values():
data_files.append(nb["notebook"])
setup(
name='European XFEL Offline Calibration',
package_dir={'cal_tools': 'cal_tools/cal_tools',
'xfel_calibrate': 'xfel_calibrate',
'xfel_calibrate.notebooks': 'xfel_calibrate/notebooks',
},
package_data={
'xfel_calibrate': ['bin/*.sh'] + data_files + ['titlepage.tmpl',
'xfel.pdf']
'install': PostInstallCommand,
},
url='',
license='(c) European XFEL GmbH 2018',
author='Steffen Hauf',
author_email='steffen.hauf@xfel.eu',
description='',
entry_points = {
'console_scripts': [