Skip to content
Snippets Groups Projects
setup.py 1.23 KiB
from setuptools import setup
from setuptools.command.install import install
from subprocess import check_call
import sys


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:
                "Not PyDetLib installation found, attempting to install"
                check_call("karabo -g https://in.xfel.eu/gitlab install pyDetLib master".split())
        else:
            print("Python environment seems to not be a Karabo environment. "+
                  "Please innstall PyDetLib manually.")
        

setup(
    name='European XFEL Offline Calibration',
    version='1.0',
    packages=['cal_tools',],
    package_dir={'cal_tools': 'cal_tools/cal_tools'},
    cmdclass={
        'install': PostInstallCommand,
    },
    url='',
    license='(c) European XFEL GmbH 2018',
    author='Steffen Hauf',
    author_email='steffen.hauf@xfel.eu',
    description=''
)