-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathsetup.py
74 lines (67 loc) · 2.51 KB
/
setup.py
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from distutils.command.build import build
from setuptools import setup, find_packages
from setuptools.command.install import install
from shutil import copyfile, rmtree
import os, sys
class mod_utils_builder(build):
def run(self):
build.run(self)
os.system("make -C utils")
class mod_utils_installer(install):
def run(self):
sharepath = os.path.join(self.install_data, "share", "mod-sdk")
if os.path.exists(sharepath):
rmtree(sharepath)
install.run(self)
source = "utils/libmod_utils.so"
target = os.path.join(self.install_lib, "modsdk", "libmod_utils.so")
print("Copying %s to %s" % (source, target))
copyfile(source, target)
MANIFEST = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'MANIFEST.in')
def data_dir(prefix, dirname):
if dirname in ("html/resources/sources",
"html/resources/knobs/generator",
"html/resources/pedals/generator"):
return []
data_files = []
html_files = []
for fname in os.listdir(dirname):
fname = os.path.join(dirname, fname)
if os.path.isfile(fname):
html_files.append(fname)
open(MANIFEST, 'a').write('include %s\n' % fname)
if os.path.isdir(fname):
data_files += data_dir(prefix, fname)
return [ (os.path.join(prefix, dirname), html_files) ] + data_files
open(MANIFEST, 'w').write('include screenshot.js\n')
share = os.path.join('share', 'mod-sdk')
data_files = data_dir(share, 'html')
data_files += [(share, ['screenshot.js'])]
setup(name = 'modsdk',
version = '2.0.0',
description = 'MOD plugin SDK.',
author = "Filipe Coelho, Luis Fagundes",
author_email = "[email protected]",
license = "GPLv3",
packages = find_packages(),
install_requires = [ 'pystache>=0.5.3', 'pillow>=2.4.0', 'tornado>=3.2' ],
data_files = data_files,
entry_points = {
'console_scripts': [
'modsdk = modsdk.webserver:run',
'modsdk-screenshot = modsdk.screenshot:run',
]
},
classifiers = [
'Intended Audience :: Developers',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
],
include_package_data = True,
url = 'http://github.com/moddevices/mod-sdk',
cmdclass={'build' : mod_utils_builder,
'install': mod_utils_installer},
)