mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
- renamed conda-recipe folder - added a check to see if build and install folder exists in build.sh (conda recipe) - created VERSION file that has '0.0.0'for developer but can be updated using update_version.py that takes in a version. The script checks for semantic versioning and updates VERSION file - VERSION file also copied along with py files to slsdet in python cmakelist and build_pylib.sh (for conda), also copied in root folder for installations (for no coding purpose) - init.py and setup.py reads this file to get the version (a bit differently to find the VERSION file) - VERSION file read into cmake to get the version and also added to compile definition. So RELEASE removed from versionAPI.h (using SLS_DET_VERSION compile definiton instead) and also removed updateRelease script. - conda getting project version from environment variable SLS_DET_VERSION that is set in build_pylib.sh prior. - added 3.13 python to conda build - anything related to ctb removed from release notes as users will always use developer - sets 0.0.0 to VERSION file by running update_version.py without an argument
78 lines
2.0 KiB
Python
Executable File
78 lines
2.0 KiB
Python
Executable File
# SPDX-License-Identifier: LGPL-3.0-or-other
|
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
"""
|
|
Setup file for slsdet
|
|
Build upon the pybind11 example found here: https://github.com/pybind/python_example
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
from setuptools import setup, find_packages
|
|
from pybind11.setup_helpers import Pybind11Extension, build_ext
|
|
|
|
def read_version():
|
|
try:
|
|
version_file = os.path.join(os.path.dirname(__file__), 'slsdet', 'VERSION')
|
|
with open(version_file, "r") as f:
|
|
return f.read().strip()
|
|
except:
|
|
raise RuntimeError("VERSION file not found in slsdet package from setup.py.")
|
|
|
|
__version__ = read_version()
|
|
|
|
|
|
def get_conda_path():
|
|
"""
|
|
Keep this a function if we need some fancier logic later
|
|
"""
|
|
print('Prefix: ', os.environ['CONDA_PREFIX'])
|
|
return os.environ['CONDA_PREFIX']
|
|
|
|
|
|
#TODO migrate to CMake build or fetch files from cmake?
|
|
ext_modules = [
|
|
Pybind11Extension(
|
|
'_slsdet',
|
|
['src/main.cpp',
|
|
'src/enums.cpp',
|
|
'src/current.cpp',
|
|
'src/detector.cpp',
|
|
'src/network.cpp',
|
|
'src/pattern.cpp',
|
|
'src/scan.cpp',
|
|
'src/duration.cpp',
|
|
'src/DurationWrapper.cpp',
|
|
'src/pedestal.cpp',
|
|
]
|
|
|
|
|
|
,
|
|
include_dirs=[
|
|
os.path.join(get_conda_path(), 'include'),
|
|
|
|
],
|
|
libraries=['SlsDetector', 'SlsSupport', 'SlsReceiver'],
|
|
library_dirs=[
|
|
os.path.join(get_conda_path(), 'lib'),
|
|
],
|
|
language='c++'
|
|
),
|
|
]
|
|
|
|
setup(
|
|
name='slsdet',
|
|
version=__version__,
|
|
author='Erik Frojdh',
|
|
author_email='erik.frojdh@psi.ch',
|
|
url='https://github.com/slsdetectorgroup/slsDetectorPackage',
|
|
description='Detector API for SLS Detector Group detectors',
|
|
long_description='',
|
|
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
|
|
package_data={
|
|
'slsdet': ['VERSION'],
|
|
},
|
|
ext_modules=ext_modules,
|
|
cmdclass={"build_ext": build_ext},
|
|
zip_safe=False,
|
|
)
|