Added support for cython when we want to use it in the future

Moved the glob to the manifest.in file
This commit is contained in:
gentlegiantJGC 2021-08-08 16:49:00 +01:00
parent 4cc8f05b50
commit ae11106e5d
4 changed files with 21 additions and 12 deletions

4
.gitignore vendored
View File

@ -6,6 +6,10 @@ __pycache__/
# C extensions
*.so
# Cython
*.c
*.html
# Distribution / packaging
.Python
build/

View File

@ -1,7 +1,10 @@
graft amulet_map_editor
include README.md
include requirements.txt
include versioneer.py
include icon.ico
prune */__pycache__/*
global-exclude *.py[cod]
global-exclude *.c
global-exclude *.html
global-exclude *.log
global-exclude *.md

View File

@ -3,6 +3,7 @@ requires = [
"setuptools >= 42",
"wheel",
"cython >= 0.29.13",
"versioneer-518"
"versioneer-518",
"numpy"
]
build-backend = "setuptools.build_meta"

View File

@ -1,9 +1,11 @@
from typing import List
from setuptools import setup, find_packages
from Cython.Build import cythonize
import os
import glob
import shutil
import sys
import numpy
try:
import versioneer
@ -51,19 +53,18 @@ try:
except:
pass
package_data = [
os.path.relpath(path, "amulet_map_editor")
for path in set(
glob.glob(os.path.join("amulet_map_editor", "**", "*.*"), recursive=True)
)
- set(
glob.glob(os.path.join("amulet_map_editor", "**", "*.py[cod]"), recursive=True)
)
]
if next(glob.iglob("amulet_map_editor/**/*.pyx", recursive=True), None):
# This throws an error if it does not match any files
ext = cythonize("amulet_map_editor/**/*.pyx")
else:
ext = ()
setup(
install_requires=required_packages,
packages=find_packages(),
package_data={"amulet_map_editor": package_data},
include_package_data=True,
cmdclass=versioneer.get_cmdclass(),
ext_modules=ext,
include_dirs=[numpy.get_include()],
)