| 1 | #!/usr/bin/env python |
| 2 | # |
| 3 | # pyfactxx - Python interface to FaCT++ reasoner |
| 4 | # |
| 5 | # Copyright (C) 2016-2018 by Artur Wroblewski <[email protected]> |
| 6 | # Copyright (C) 2021-2022 by Ivan Rygaev <[email protected]> |
| 7 | # |
| 8 | # This program is free software: you can redistribute it and/or modify |
| 9 | # it under the terms of the GNU General Public License as published by |
| 10 | # the Free Software Foundation, either version 3 of the License, or |
| 11 | # (at your option) any later version. |
| 12 | # |
| 13 | # This program is distributed in the hope that it will be useful, |
| 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | # GNU General Public License for more details. |
| 17 | # |
| 18 | # You should have received a copy of the GNU General Public License |
| 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | # |
| 21 | |
| 22 | import re |
| 23 | import ast |
| 24 | import pathlib |
| 25 | from skbuild import setup |
| 26 | |
| 27 | |
| 28 | root = pathlib.Path(__file__).parent.resolve() |
| 29 | DEBUG = False |
| 30 | |
| 31 | _version_re = re.compile(r'__version__\s+=\s+(.*)') |
| 32 | |
| 33 | with open('pyfactxx/__init__.py', 'rb') as f: |
| 34 | version = str(ast.literal_eval(_version_re.search( |
| 35 | f.read().decode('utf-8')).group(1))) |
| 36 | |
| 37 | config = 'Debug' if DEBUG else 'Release' |
| 38 | cmake_args = [ |
| 39 | f'-DCMAKE_BUILD_TYPE={config}', |
| 40 | f'-DPYFACTXX_ROOT={root.as_posix()}' |
| 41 | ] |
| 42 | |
| 43 | setup( |
| 44 | version=version, |
| 45 | packages=[ |
| 46 | "pyfactxx", |
| 47 | "pyfactxx.coras"], |
| 48 | package_dir={ |
| 49 | "pyfactxx": "pyfactxx", |
| 50 | "pyfactxx.coras": "pyfactxx/coras"}, |
| 51 | cmake_source_dir=str(root/'pyfactxx'), |
| 52 | cmake_args=cmake_args |
| 53 | ) |