Skip to content

Commit

Permalink
Added support for cython when we want to use it in the future
Browse files Browse the repository at this point in the history
Moved the glob to the manifest.in file
  • Loading branch information
gentlegiantJGC committed Aug 8, 2021
1 parent 4cc8f05 commit ae11106
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -6,6 +6,10 @@ __pycache__/
# C extensions
*.so

# Cython
*.c
*.html

# Distribution / packaging
.Python
build/
Expand Down
5 changes: 4 additions & 1 deletion MANIFEST.in
@@ -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
3 changes: 2 additions & 1 deletion pyproject.toml
Expand Up @@ -3,6 +3,7 @@ requires = [
"setuptools >= 42",
"wheel",
"cython >= 0.29.13",
"versioneer-518"
"versioneer-518",
"numpy"
]
build-backend = "setuptools.build_meta"
21 changes: 11 additions & 10 deletions setup.py
@@ -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
Expand Down Expand Up @@ -51,19 +53,18 @@ def load_requirements(path: str) -> List[str]:
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()],
)

0 comments on commit ae11106

Please sign in to comment.