Initial project config and implement build process
Enhanced the .gitignore to filter out additional build artifacts and Python cache files, promoting a cleaner repository state. Introduced a basic project structure with a new pyproject.toml, defining metadata and build requirements for the 'limedriver' Python package. Also added a LICENSE file and a custom setup.py which automates the retrieval and build of 'limedriver' submodules, streamlining the set-up for development and ensuring consistent builds across environments. These changes lay the groundwork for further development and distribution of the project.
This commit is contained in:
parent
22737fbc68
commit
0465a51a46
4 changed files with 80 additions and 0 deletions
49
setup.py
Normal file
49
setup.py
Normal file
|
@ -0,0 +1,49 @@
|
|||
from setuptools import setup, Extension
|
||||
from setuptools.command.build_ext import build_ext
|
||||
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
from Cython.Build import cythonize
|
||||
|
||||
class BuildExtCommand(build_ext):
|
||||
"""Custom build_ext command to ensure that the submodule is retrieved and built."""
|
||||
|
||||
def build_extensions(self):
|
||||
os.environ['CXX'] = 'h5c++'
|
||||
super().build_extensions()
|
||||
|
||||
def run(self):
|
||||
if not os.path.exists('extern/limedriver'):
|
||||
self.clone_limedriver()
|
||||
|
||||
self.build_limedriver()
|
||||
|
||||
super().run()
|
||||
|
||||
def clone_limedriver(self):
|
||||
subprocess.check_call(['git', 'submodule', 'init'])
|
||||
subprocess.check_call(['git', 'submodule', 'update'])
|
||||
|
||||
def build_limedriver(self):
|
||||
subprocess.check_call(['./configure'], cwd='extern/limedriver')
|
||||
subprocess.check_call(['make'], cwd='extern/limedriver')
|
||||
|
||||
ext_modules = [
|
||||
Extension(
|
||||
'limedriver',
|
||||
sources=['src/limedriver/limedriver.pyx'],
|
||||
include_dirs=["extern/limedriver/src/"],
|
||||
libraries=["LimeSuite"],
|
||||
),
|
||||
]
|
||||
|
||||
setup(
|
||||
name='limedriver',
|
||||
|
||||
cmdclass={
|
||||
'build_ext': BuildExtCommand,
|
||||
},
|
||||
|
||||
ext_modules=cythonize(ext_modules),
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue