setup.py
Go to the documentation of this file.
1 import os
2 import sys
3 from setuptools import setup, find_packages
4 from setuptools.dist import Distribution
5 
6 class BinaryDistribution(Distribution):
7  """Distribution which always forces a binary package with platform name
8  """
9  def has_ext_modules(self):
10  return True
11 
12 path_to_file = os.path.relpath(os.path.join("..", "pointmatcher", "PointMatcher.h"))
13 
14 
15 version = None
16 
17 # (!) Limitation: This approach to fetching the POINTMATCHER_VERSION only work if the user execute
18 # python -m build --wheel
19 # It will break when using the default
20 # python -m build
21 try:
22  with open(path_to_file, "r", encoding="utf-8") as f:
23  for line in map(str.strip, f):
24  if line.startswith("#define POINTMATCHER_VERSION"):
25  version = line.split()[2].replace("\"", "")
26  break
27 except FileNotFoundError:
28  print(f"Cannot find: '{path_to_file}'. Probably reason is you run 'python -m build', but not 'python -m build --no-isolation --wheel'", file=sys.stderr)
29  raise
30 
31 if version is None:
32  raise RuntimeError(f"Cannot find a version string in the file: '{path_to_file}'")
33 
34 
35 setup(packages=find_packages(include=["pypointmatcher*"]),
36  install_requires=["numpy>=1.20"],
37  package_data={"": ["*.so"]},
38  version=version,
39  distclass=BinaryDistribution
40  )
Definition: setup.py:1
def has_ext_modules(self)
Definition: setup.py:9


libpointmatcher
Author(s):
autogenerated on Sat May 27 2023 02:38:03