aboutsummaryrefslogtreecommitdiffstats
path: root/setup.py
blob: 68b2e74d1b1bed9f29ce97020a30ab9c6b2ca647 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env python3

import os, re
from setuptools import setup

import setup_cython


def getEnvInt(name, default=0):
	try:
		return int(os.getenv(name, "%d" % default))
	except ValueError:
		return default

def getEnvBool(name, default=False):
	return bool(getEnvInt(name, 1 if default else 0))

def pyCythonPatchLine(line):
	# Patch the import statements
	line = re.sub(r'^(\s*from cms)(\.[0-9a-zA-Z_\.]+)? (c?import)', r'\1_cython\2 \3', line)
	line = re.sub(r'^(\s*c?import cms)(\.)?', r'\1_cython\2', line)
	return line

buildCython = getEnvBool("CMS_CYTHON_BUILD", True)
setup_cython.parallelBuild = getEnvBool("CMS_CYTHON_PARALLEL", True)
setup_cython.profileEnabled = getEnvBool("CMS_PROFILE")
setup_cython.debugEnabled = getEnvBool("CMS_DEBUG_BUILD")
setup_cython.pyCythonPatchLine = pyCythonPatchLine

cmdclass = {}

if buildCython:
	buildCython = setup_cython.cythonBuildPossible()
if buildCython:
	cmdclass["build_ext"] = setup_cython.CythonBuildExtension
	setup_cython.registerCythonModules()
else:
	print("Skipping build of CYTHON modules.")

ext_modules = setup_cython.ext_modules

setup(	name		= "cms",
	version		= "0.0",
	description	= "Simple Rust and Python based CMS",
	license		= "GNU General Public License v2 or later",
	author		= "Michael Buesch",
	author_email	= "m@bues.ch",
	url		= "https://bues.ch",
	packages	= [ "cms", ],
	cmdclass	= cmdclass,
	ext_modules	= ext_modules,
	classifiers	= [
		"Development Status :: 5 - Production/Stable",
		"Environment :: Console",
		"Intended Audience :: Developers",
		"Intended Audience :: Other Audience",
		"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
		"Operating System :: POSIX",
		"Operating System :: POSIX :: Linux",
		"Programming Language :: Cython",
		"Programming Language :: Python",
		"Programming Language :: Python :: 3",
		"Programming Language :: Python :: Implementation :: CPython",
		"Topic :: Database",
		"Topic :: Database :: Database Engines/Servers",
		"Topic :: Database :: Front-Ends",
		"Topic :: Internet",
		"Topic :: Internet :: WWW/HTTP",
		"Topic :: Internet :: WWW/HTTP :: Browsers",
		"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
		"Topic :: Internet :: WWW/HTTP :: Site Management",
		"Topic :: Text Processing",
		"Topic :: Text Processing :: Markup :: HTML",
	],
	long_description = "Simple Rust and Python based CMS"
)
bues.ch cgit interface