1. Cython compile system build. 2. License system build. 3. Auto md file generation for Sphinx build.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import os
|
||||
from setuptools import setup, Extension
|
||||
from Cython.Build import cythonize
|
||||
|
||||
def find_pyx_files(directory):
|
||||
"""Finds all .py files to compile, ignoring __init__.py and docs."""
|
||||
paths = []
|
||||
for root, dirs, files in os.walk(directory):
|
||||
# Skip the docs folder
|
||||
if 'docs' in dirs:
|
||||
dirs.remove('docs')
|
||||
|
||||
for file in files:
|
||||
if file.endswith(".py") and file != "__init__.py":
|
||||
paths.append(os.path.join(root, file))
|
||||
return paths
|
||||
|
||||
# Define the files to compile
|
||||
source_files = find_pyx_files("mxpic")
|
||||
|
||||
# Create extensions
|
||||
extensions = [
|
||||
Extension(
|
||||
name=file.replace(os.sep, ".")[:-3], # e.g., mxpic.components.mzm
|
||||
sources=[file],
|
||||
)
|
||||
for file in source_files
|
||||
]
|
||||
|
||||
setup(
|
||||
name="mxpic",
|
||||
version="1.0.0",
|
||||
ext_modules=cythonize(
|
||||
extensions,
|
||||
compiler_directives={'language_level': "3"} # Force Python 3
|
||||
),
|
||||
)
|
||||
Reference in New Issue
Block a user