forked from frePPLe/frepple
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py.in
89 lines (80 loc) · 3.02 KB
/
setup.py.in
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
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env python3
#
# Copyright (C) 2009-2019 by frePPLe bv
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
# General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public
# License along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from distutils.core import setup
import os
import sys
def fullsplit(path, result=None):
"""
Split a pathname into components (the opposite of os.path.join) in a
platform-neutral way.
"""
if result is None:
result = []
head, tail = os.path.split(path)
if head == "":
return [tail] + result
if head == path:
return result
return fullsplit(head, [tail] + result)
# Tell distutils not to put the data_files in platform-specific installation
# locations. See here for an explanation:
# http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
from distutils.command.install import INSTALL_SCHEMES
for scheme in INSTALL_SCHEMES.values():
scheme["data"] = scheme["purelib"]
# Compile the list of packages and data files
packages = []
data_files = []
root_dir = "@CMAKE_CURRENT_SOURCE_DIR@"
if root_dir != "":
os.chdir(root_dir)
for dirpath, dirnames, filenames in os.walk("freppledb"):
# Ignore dirnames that start with '.'
for i, dirname in enumerate(dirnames):
if dirname.startswith("."):
del dirnames[i]
if "__init__.py" in filenames:
packages.append(".".join(fullsplit(dirpath)))
elif filenames:
data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
# Small hack for working with bdist_wininst.
# See http://mail.python.org/pipermail/distutils-sig/2004-August/004134.html
if len(sys.argv) > 1 and sys.argv[1] == "bdist_wininst":
for file_info in data_files:
file_info[0] = "\\PURELIB\\%s" % file_info[0]
setup(
name="freppledb",
version="@PROJECT_VERSION@",
package_dir={ "": "@CMAKE_CURRENT_SOURCE_DIR@" },
author="frepple.com",
author_email="info@frepple.com",
url="http://frepple.com",
packages=packages,
data_files=data_files,
options={"install": {"optimize": 2}},
classifiers=[
"License :: OSI Approved :: GNU Affero General Public License (AGPL)",
"Intended Audience :: Manufacturing",
"Framework :: Django",
],
description="frePPLe - Open source Production PLanning",
long_description="""FrePPLe stands for "Free Production Planning Library".
It is a framework for modeling and solving production planning problems,
targeted primarily at discrete manufacturing industries.
""",
)