-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
164 lines (118 loc) · 3.77 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
"""pycms Setup Script
Copyright (c) 2013 Florian Berger <[email protected]>
"""
# This file is part of pycms.
#
# pycms is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pycms 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pycms. If not, see <http://www.gnu.org/licenses/>.
# Work started on 30. Sep 2013.
import os.path
import pycms
PACKAGE = "pycms"
# Fallback
#
from distutils.core import setup
SCRIPTS = ["pycmscmd.py"]
EXECUTABLES = []
try:
import cx_Freeze
setup = cx_Freeze.setup
EXECUTABLES = [cx_Freeze.Executable(path) for path in SCRIPTS]
except ImportError:
print("Warning: the cx_Freeze module could not be imported. You will not be able to build binary packages.")
# A list of files to include. These must be actual file names along with a
# complete path, starting from the current package directory. Directories
# are not allowed.
#
INCLUDE_FILES = []
LONG_DESCRIPTION = """About
-----
pycms is a lightweight web content management system.
Prerequisites
-------------
Python http://www.python.org
Installation
------------
Unzip the file, then at the command line run
::
python setup.py install
Usage
-----
On the command line, run
::
python3 pycms.py
Documentation
-------------
To read the API documentation, open a shell / DOS window, navigate to
the pycms directory, and run
::
pydoc pycms
You can create a HTML version using
::
pydoc -w pycms
License
-------
pycms is licensed under the GPL. See the file COPYING for details.
Author
------
Florian Berger"""
# Python 2.x doesn't honour the 'package_dir' and 'package_data' arguments to
# setup() when building an 'sdist'. Generate MANIFEST.in containing the
# necessary files.
#
print("regenerating MANIFEST.in for Python 2.x")
MANIFEST = open("MANIFEST.in", "wt")
MANIFEST.write("include COPYING\n")
MANIFEST.close()
# Warn about symlinks
#
for file in INCLUDE_FILES:
if os.path.islink(file):
print("WARNING: '{0}' is a symbolic link. Please make sure that it refers to an absolute path.".format(file))
# Compute pairs of (destdir, [file, ...]) for the setup(data_files = ...) option
# from INCLUDE_FILES.
#
# Files will be installed in <prefix>/share/PACKAGE/ by `setup.py install`.
#
DATA_FILES = {}
for path in INCLUDE_FILES:
target_dir = os.path.join("share", PACKAGE, os.path.dirname(path))
if target_dir in DATA_FILES.keys():
DATA_FILES[target_dir].append(path)
else:
DATA_FILES[target_dir] = [path]
# For most operations, cx_Freeze.setup() is a wrapper for distutils.core.setup().
#
# DATA_FILES.items() returns a list of (directory, [file, ...]) tuples as
# expected by setup().
#
# The syntax for the "include_files" option to "build_exe" is [(src, target), ...]
#
setup(name = PACKAGE,
version = pycms.VERSION,
author = "Florian Berger",
author_email = "[email protected]",
url = "http://florian-berger.de/en/software/pycms",
description = PACKAGE + " - a lightweight web content management system.",
long_description = LONG_DESCRIPTION,
license = "GPL",
py_modules = [],
packages = [PACKAGE],
requires = [],
provides = [PACKAGE],
scripts = SCRIPTS,
data_files = DATA_FILES.items(),
executables = EXECUTABLES,
options = {"build_exe" :
{"include_files" : INCLUDE_FILES}
})