aboutsummaryrefslogtreecommitdiffstats
path: root/setup_c_extension.py
blob: 9bed938cae4a0853a820bb94c77ebc938519d38f (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
from distutils.core import setup, Extension

extra_compile_args = []

# Detect if distribution is Ubuntu or Debian based
with open('/etc/os-release') as f:
	lines = filter(None, f.read().split('\n'))

	info = {}
	for (key, val) in map(lambda x: x.split('='), lines):
		info[key] = val

	# The ID_LIKE key is usually a space separated list of OSes upon which the distribution is based.
	if any(os in ('ubuntu', 'debian') for os in info['ID_LIKE'].split()):
		extra_compile_args.append('-DDEBIAN_LINUX')


setup(name = 'o3000', version = '1.0',
		ext_modules = [Extension(
				'o3000',
				sources = ['c_extension.c', 'helpers.c'],
				libraries = ['o3000','o3000_imgpipe','tiff'],
				extra_compile_args = extra_compile_args # + ['-Wextra']
		)])