summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2015-01-01 22:08:09 +0100
committerDave Andreoli <dave@gurumeditation.it>2015-01-01 22:08:09 +0100
commit379aef8950fbad706a9bffc8c6c3ba57789f09cc (patch)
tree3e3fd79938b746cac3dc2ba694a2ef02de159e25 /setup.py
parentfd1167e8cc8e16a9b63e9bead621cfc417c5f05c (diff)
setup.py cleanups: indentation
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py284
1 files changed, 122 insertions, 162 deletions
diff --git a/setup.py b/setup.py
index b99d1e2..86f426e 100755
--- a/setup.py
+++ b/setup.py
@@ -18,15 +18,15 @@ VERSION = "%d.%d" % (vers[0], vers[1] if vers[2] < 99 else vers[1] + 1)
18 18
19# dependencies 19# dependencies
20CYTHON_MIN_VERSION = "0.19" 20CYTHON_MIN_VERSION = "0.19"
21EFL_MIN_VERSION = RELEASE 21EFL_MIN_VER = RELEASE
22ELM_MIN_VERSION = RELEASE 22ELM_MIN_VER = RELEASE
23 23
24 24
25# Add git commit count for dev builds 25# Add git commit count for dev builds
26if vers[2] == 99: 26if vers[2] == 99:
27 try: 27 try:
28 call = subprocess.Popen( 28 call = subprocess.Popen(["git", "log", "--oneline"],
29 ["git", "log", "--oneline"], stdout=subprocess.PIPE) 29 stdout=subprocess.PIPE)
30 out, err = call.communicate() 30 out, err = call.communicate()
31 except Exception: 31 except Exception:
32 RELEASE += "a0" 32 RELEASE += "a0"
@@ -48,8 +48,7 @@ try:
48 from sphinx.setup_command import BuildDoc 48 from sphinx.setup_command import BuildDoc
49except ImportError: 49except ImportError:
50 class BuildDoc(Command): 50 class BuildDoc(Command):
51 description = \ 51 description = "build docs using sphinx, that must be installed."
52 "build documentation using sphinx, that must be installed."
53 version = "" 52 version = ""
54 release = "" 53 release = ""
55 user_options = [] 54 user_options = []
@@ -69,22 +68,22 @@ def pkg_config(name, require, min_vers=None):
69 try: 68 try:
70 sys.stdout.write("Checking for " + name + ": ") 69 sys.stdout.write("Checking for " + name + ": ")
71 70
72 call = subprocess.Popen( 71 call = subprocess.Popen(["pkg-config", "--modversion", require],
73 ["pkg-config", "--modversion", require], stdout=subprocess.PIPE) 72 stdout=subprocess.PIPE)
74 out, err = call.communicate() 73 out, err = call.communicate()
75 ver = out.decode("utf-8").strip() 74 ver = out.decode("utf-8").strip()
76 75
77 if min_vers is not None: 76 if min_vers is not None:
78 assert 0 == subprocess.call( 77 assert 0 == subprocess.call(["pkg-config", "--atleast-version",
79 ["pkg-config", "--atleast-version", min_vers, require]) 78 min_vers, require])
80 79
81 call = subprocess.Popen( 80 call = subprocess.Popen(["pkg-config", "--cflags", require],
82 ["pkg-config", "--cflags", require], stdout=subprocess.PIPE) 81 stdout=subprocess.PIPE)
83 out, err = call.communicate() 82 out, err = call.communicate()
84 cflags = out.decode("utf-8").split() 83 cflags = out.decode("utf-8").split()
85 84
86 call = subprocess.Popen( 85 call = subprocess.Popen(["pkg-config", "--libs", require],
87 ["pkg-config", "--libs", require], stdout=subprocess.PIPE) 86 stdout=subprocess.PIPE)
88 out, err = call.communicate() 87 out, err = call.communicate()
89 libs = out.decode("utf-8").split() 88 libs = out.decode("utf-8").split()
90 89
@@ -96,13 +95,11 @@ def pkg_config(name, require, min_vers=None):
96 except (OSError, subprocess.CalledProcessError): 95 except (OSError, subprocess.CalledProcessError):
97 raise SystemExit("Did not find " + name + " with 'pkg-config'.") 96 raise SystemExit("Did not find " + name + " with 'pkg-config'.")
98 except (AssertionError): 97 except (AssertionError):
99 raise SystemExit( 98 raise SystemExit("%s version mismatch. Found: %s Needed %s" % (
100 name + " version mismatch. Found: " + ver + " Needed: " + min_vers 99 name, ver, min_vers))
101 )
102
103 100
104# use cython or pre-generated c files
105 101
102# === cython or pre-generated c files ===
106if os.getenv("DISABLE_CYTHON"): 103if os.getenv("DISABLE_CYTHON"):
107 module_suffix = ".c" 104 module_suffix = ".c"
108 from distutils.command.build_ext import build_ext 105 from distutils.command.build_ext import build_ext
@@ -116,11 +113,8 @@ else:
116 import Cython.Compiler.Options 113 import Cython.Compiler.Options
117 except ImportError: 114 except ImportError:
118 if not os.path.exists(os.path.join(script_path, "efl/eo/efl.eo.c")): 115 if not os.path.exists(os.path.join(script_path, "efl/eo/efl.eo.c")):
119 raise SystemExit( 116 raise SystemExit("Requires Cython >= %s (http://cython.org/)" % (
120 "Requires Cython >= %s (http://cython.org/)" % ( 117 CYTHON_MIN_VERSION))
121 CYTHON_MIN_VERSION
122 )
123 )
124 module_suffix = ".c" 118 module_suffix = ".c"
125 from distutils.command.build_ext import build_ext 119 from distutils.command.build_ext import build_ext
126 120
@@ -145,22 +139,19 @@ may be caused by version of Cython that's too old.""" % (
145 assert LooseVersion(Cython.__version__) >= \ 139 assert LooseVersion(Cython.__version__) >= \
146 LooseVersion(CYTHON_MIN_VERSION) 140 LooseVersion(CYTHON_MIN_VERSION)
147 except AssertionError: 141 except AssertionError:
148 raise SystemExit( 142 raise SystemExit("Requires Cython >= %s (http://cython.org/)" % (
149 "Requires Cython >= %s (http://cython.org/)" % ( 143 CYTHON_MIN_VERSION))
150 CYTHON_MIN_VERSION
151 )
152 )
153 144
154 # Cython 0.21.1 PyMethod_New() is broken! blacklisted 145 # Cython 0.21.1 PyMethod_New() is broken! blacklisted
155 if Cython.__version__ == "0.21.1": 146 if Cython.__version__ == "0.21.1":
156 raise SystemExit("Cython 0.21.1 is broken! Use another release.") 147 raise SystemExit("Cython 0.21.1 is broken! Use another release.")
157 148
158 Cython.Compiler.Options.fast_fail = True # Stop compilation on first 149 # Stop compilation on first error
159 # error 150 Cython.Compiler.Options.fast_fail = True
160 Cython.Compiler.Options.annotate = False # Generates HTML files with 151 # Generates HTML files with annotated source
161 # annotated source 152 Cython.Compiler.Options.annotate = False
162 Cython.Compiler.Options.docstrings = True # Set to False to disable 153 # Set to False to disable docstrings
163 # docstrings 154 Cython.Compiler.Options.docstrings = True
164 155
165 156
166class CleanGenerated(Command): 157class CleanGenerated(Command):
@@ -176,14 +167,13 @@ class CleanGenerated(Command):
176 def run(self): 167 def run(self):
177 for lib in ("eo", "evas", "ecore", "edje", "edje/edit", "emotion", 168 for lib in ("eo", "evas", "ecore", "edje", "edje/edit", "emotion",
178 "elementary", "ethumb", "utils"): 169 "elementary", "ethumb", "utils"):
179 for root, dirs, files in \ 170 lib_path = os.path.join(script_path, "efl", lib)
180 os.walk(os.path.join(script_path, "efl", lib)): 171 for root, dirs, files in os.walk(lib_path):
181 for f in files: 172 for f in files:
182 if f.endswith(".c") or f.endswith(".html"): 173 if f.endswith(".c") or f.endswith(".html"):
183 path = os.path.join(root, f) 174 os.remove(os.path.join(root, f))
184 os.remove(path) 175 dbus_ml_path = os.path.join(script_path, "efl", "dbus_mainloop",
185 dbus_ml_path = os.path.join( 176 "dbus_mainloop.c")
186 script_path, "efl", "dbus_mainloop", "dbus_mainloop.c")
187 if os.path.exists(dbus_ml_path): 177 if os.path.exists(dbus_ml_path):
188 os.remove(dbus_ml_path) 178 os.remove(dbus_ml_path)
189 179
@@ -195,155 +185,129 @@ packages = ["efl"]
195if set(("build", "build_ext", "install", "bdist", "sdist")) & set(sys.argv): 185if set(("build", "build_ext", "install", "bdist", "sdist")) & set(sys.argv):
196 186
197 # === Eina === 187 # === Eina ===
198 eina_cflags, eina_libs = pkg_config('Eina', 'eina', EFL_MIN_VERSION) 188 eina_cflags, eina_libs = pkg_config('Eina', 'eina', EFL_MIN_VER)
199 189
200 # === Eo === 190 # === Eo ===
201 eo_cflags, eo_libs = pkg_config('Eo', 'eo', EFL_MIN_VERSION) 191 eo_cflags, eo_libs = pkg_config('Eo', 'eo', EFL_MIN_VER)
202 eo_ext = Extension( 192 eo_ext = Extension("eo", ["efl/eo/efl.eo" + module_suffix],
203 "eo", ["efl/eo/efl.eo" + module_suffix], 193 define_macros=[('EFL_BETA_API_SUPPORT', None)],
204 define_macros=[('EFL_BETA_API_SUPPORT', None)], 194 include_dirs=['include/'],
205 include_dirs=['include/'], 195 extra_compile_args=eo_cflags,
206 extra_compile_args=eo_cflags, 196 extra_link_args=eo_libs + eina_libs
207 extra_link_args=eo_libs + eina_libs 197 )
208 )
209 ext_modules.append(eo_ext) 198 ext_modules.append(eo_ext)
210 199
211 # === Utilities === 200 # === Utilities ===
212 utils_ext = [ 201 utils_ext = [
213 Extension( 202 Extension("utils.deprecated", ["efl/utils/deprecated" + module_suffix],
214 "utils.deprecated", ["efl/utils/deprecated" + module_suffix], 203 include_dirs=['include/'],
215 include_dirs=['include/'], 204 extra_compile_args=eina_cflags,
216 extra_compile_args=eina_cflags, 205 extra_link_args=eina_libs),
217 extra_link_args=eina_libs 206 Extension("utils.conversions", ["efl/utils/conversions" + module_suffix],
218 ), 207 include_dirs=['include/'],
219 Extension( 208 extra_compile_args=eo_cflags,
220 "utils.conversions", ["efl/utils/conversions" + module_suffix], 209 extra_link_args=eo_libs + eina_libs),
221 include_dirs=['include/'], 210 Extension("utils.logger", ["efl/utils/logger" + module_suffix],
222 extra_compile_args=eo_cflags, 211 include_dirs=['include/'],
223 extra_link_args=eo_libs + eina_libs, 212 extra_compile_args=eina_cflags,
224 ), 213 extra_link_args=eina_libs),
225 Extension(
226 "utils.logger", ["efl/utils/logger" + module_suffix],
227 include_dirs=['include/'],
228 extra_compile_args=eina_cflags,
229 extra_link_args=eina_libs,
230 ),
231 ] 214 ]
232 ext_modules.extend(utils_ext) 215 ext_modules.extend(utils_ext)
233 py_modules.append("efl.utils.setup") 216 py_modules.append("efl.utils.setup")
234 packages.append("efl.utils") 217 packages.append("efl.utils")
235 218
236 # === Evas === 219 # === Evas ===
237 evas_cflags, evas_libs = pkg_config('Evas', 'evas', EFL_MIN_VERSION) 220 evas_cflags, evas_libs = pkg_config('Evas', 'evas', EFL_MIN_VER)
238 evas_ext = Extension( 221 evas_ext = Extension("evas", ["efl/evas/efl.evas" + module_suffix],
239 "evas", ["efl/evas/efl.evas" + module_suffix], 222 include_dirs=['include/'],
240 include_dirs=['include/'], 223 extra_compile_args=evas_cflags,
241 extra_compile_args=evas_cflags, 224 extra_link_args=evas_libs + eina_libs)
242 extra_link_args=evas_libs + eina_libs,
243 )
244 ext_modules.append(evas_ext) 225 ext_modules.append(evas_ext)
245 226
246 # === Ecore === 227 # === Ecore ===
247 ecore_cflags, ecore_libs = pkg_config('Ecore', 'ecore', EFL_MIN_VERSION) 228 ecore_cflags, ecore_libs = pkg_config('Ecore', 'ecore', EFL_MIN_VER)
248 ecore_file_cflags, ecore_file_libs = pkg_config( 229 ecore_file_cflags, ecore_file_libs = pkg_config(
249 'EcoreFile', 'ecore-file', EFL_MIN_VERSION) 230 'EcoreFile', 'ecore-file', EFL_MIN_VER)
250 ecore_exts = [ 231 ecore_exts = [
251 Extension( 232 Extension("ecore.__init__", ["efl/ecore/__init__" + module_suffix],
252 "ecore.__init__", ["efl/ecore/__init__" + module_suffix], 233 include_dirs=['include/'],
253 include_dirs=['include/'], 234 extra_compile_args=list(set(ecore_cflags + ecore_file_cflags)),
254 extra_compile_args=list(set(ecore_cflags + ecore_file_cflags)), 235 extra_link_args=ecore_libs + ecore_file_libs + eina_libs +
255 extra_link_args=ecore_libs + ecore_file_libs + eina_libs + 236 evas_libs),
256 evas_libs
257 ),
258 ] 237 ]
259 try: 238 try:
260 ecore_input_cflags, ecore_input_libs = pkg_config( 239 ecore_input_cflags, ecore_input_libs = pkg_config(
261 'EcoreInput', 'ecore-input', EFL_MIN_VERSION) 240 'EcoreInput', 'ecore-input', EFL_MIN_VER)
262 ecore_x_cflags, ecore_x_libs = pkg_config( 241 ecore_x_cflags, ecore_x_libs = pkg_config(
263 'EcoreX', 'ecore-x', EFL_MIN_VERSION) 242 'EcoreX', 'ecore-x', EFL_MIN_VER)
264 except SystemExit: # FIXME: Change pkg-config to return a value 243 except SystemExit: # FIXME: Change pkg-config to return a value
265 pass 244 pass
266 else: 245 else:
267 ecore_exts.append( 246 ecore_exts.append(
268 Extension( 247 Extension("ecore.x", ["efl/ecore/x" + module_suffix],
269 "ecore.x", ["efl/ecore/x" + module_suffix], 248 include_dirs=['include/'],
270 include_dirs=['include/'], 249 extra_compile_args=list(set(ecore_cflags +
271 extra_compile_args= 250 ecore_file_cflags +
272 list(set( 251 ecore_x_cflags +
273 ecore_cflags + ecore_file_cflags + ecore_x_cflags + 252 ecore_input_cflags)),
274 ecore_input_cflags 253 extra_link_args=ecore_libs + ecore_file_libs +
275 )), 254 ecore_x_libs + ecore_input_libs +
276 extra_link_args= 255 eina_libs + evas_libs)
277 ecore_libs + ecore_file_libs + ecore_x_libs + 256 )
278 ecore_input_libs +
279 eina_libs + evas_libs,
280 )
281 )
282 ext_modules.extend(ecore_exts) 257 ext_modules.extend(ecore_exts)
283 packages.append("efl.ecore") 258 packages.append("efl.ecore")
284 259
285 # === Ethumb === 260 # === Ethumb ===
286 ethumb_cflags, ethumb_libs = pkg_config( 261 ethumb_cflags, ethumb_libs = pkg_config('Ethumb', 'ethumb', EFL_MIN_VER)
287 'Ethumb', 'ethumb', EFL_MIN_VERSION) 262 ethumb_ext = Extension("ethumb", ["efl/ethumb/efl.ethumb" + module_suffix],
288 ethumb_ext = Extension( 263 include_dirs=['include/'],
289 "ethumb", ["efl/ethumb/efl.ethumb" + module_suffix], 264 extra_compile_args=ethumb_cflags,
290 include_dirs=['include/'], 265 extra_link_args=ethumb_libs + eina_libs)
291 extra_compile_args=ethumb_cflags,
292 extra_link_args=ethumb_libs + eina_libs,
293 )
294 ext_modules.append(ethumb_ext) 266 ext_modules.append(ethumb_ext)
295 267
296 ethumb_client_cflags, ethumb_client_libs = pkg_config( 268 ethumb_client_cflags, ethumb_client_libs = pkg_config(
297 'Ethumb_Client', 'ethumb_client', EFL_MIN_VERSION) 269 'Ethumb_Client', 'ethumb_client', EFL_MIN_VER)
298 ethumb_client_ext = Extension( 270 ethumb_client_ext = Extension("ethumb_client",
299 "ethumb_client", ["efl/ethumb/efl.ethumb_client" + module_suffix], 271 ["efl/ethumb/efl.ethumb_client" + module_suffix],
300 include_dirs=['include/'], 272 include_dirs=['include/'],
301 extra_compile_args=ethumb_client_cflags, 273 extra_compile_args=ethumb_client_cflags,
302 extra_link_args=ethumb_client_libs + eina_libs, 274 extra_link_args=ethumb_client_libs + eina_libs)
303 )
304 ext_modules.append(ethumb_client_ext) 275 ext_modules.append(ethumb_client_ext)
305 276
306 # === Edje === 277 # === Edje ===
307 edje_cflags, edje_libs = pkg_config('Edje', 'edje', EFL_MIN_VERSION) 278 edje_cflags, edje_libs = pkg_config('Edje', 'edje', EFL_MIN_VER)
308 edje_ext = Extension( 279 edje_ext = Extension("edje", ["efl/edje/efl.edje" + module_suffix],
309 "edje", ["efl/edje/efl.edje" + module_suffix], 280 include_dirs=['include/'],
310 include_dirs=['include/'], 281 extra_compile_args=edje_cflags,
311 extra_compile_args=edje_cflags, 282 extra_link_args=edje_libs + eina_libs + evas_libs)
312 extra_link_args=edje_libs + eina_libs + evas_libs,
313 )
314 ext_modules.append(edje_ext) 283 ext_modules.append(edje_ext)
315 284
316 # --- Edje_Edit --- 285 # --- Edje_Edit ---
317 edje_edit_ext = Extension( 286 edje_edit_ext = Extension("edje_edit",
318 "edje_edit", ["efl/edje/efl.edje_edit" + module_suffix], 287 ["efl/edje/efl.edje_edit" + module_suffix],
319 define_macros=[('EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT', None)], 288 define_macros=[('EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT', None)],
320 include_dirs=['include/'], 289 include_dirs=['include/'],
321 extra_compile_args=edje_cflags, 290 extra_compile_args=edje_cflags,
322 extra_link_args=edje_libs + eina_libs + evas_libs, 291 extra_link_args=edje_libs + eina_libs + evas_libs)
323 )
324 ext_modules.append(edje_edit_ext) 292 ext_modules.append(edje_edit_ext)
325 293
326 # === Emotion === 294 # === Emotion ===
327 emotion_cflags, emotion_libs = pkg_config( 295 emotion_cflags, emotion_libs = pkg_config('Emotion', 'emotion', EFL_MIN_VER)
328 'Emotion', 'emotion', EFL_MIN_VERSION) 296 emotion_ext = Extension("emotion",
329 emotion_ext = Extension( 297 ["efl/emotion/efl.emotion" + module_suffix],
330 "emotion", ["efl/emotion/efl.emotion" + module_suffix], 298 include_dirs=['include/'],
331 include_dirs=['include/'], 299 extra_compile_args=emotion_cflags,
332 extra_compile_args=emotion_cflags, 300 extra_link_args=emotion_libs +
333 extra_link_args=emotion_libs + 301 eina_libs + evas_libs)
334 eina_libs + evas_libs,
335 )
336 ext_modules.append(emotion_ext) 302 ext_modules.append(emotion_ext)
337 303
338 # === dbus mainloop integration === 304 # === dbus mainloop integration ===
339 dbus_cflags, dbus_libs = pkg_config('DBus', 'dbus-python', "0.83.0") 305 dbus_cflags, dbus_libs = pkg_config('DBus', 'dbus-python', "0.83.0")
340 dbus_ml_ext = Extension( 306 dbus_ml_ext = Extension("dbus_mainloop",
341 "dbus_mainloop", 307 ["efl/dbus_mainloop/dbus_mainloop" + module_suffix,
342 ["efl/dbus_mainloop/dbus_mainloop" + module_suffix, 308 "efl/dbus_mainloop/e_dbus.c"],
343 "efl/dbus_mainloop/e_dbus.c"], 309 extra_compile_args=list(set(dbus_cflags + ecore_cflags)),
344 extra_compile_args=list(set(dbus_cflags + ecore_cflags)), 310 extra_link_args=dbus_libs + ecore_libs)
345 extra_link_args=dbus_libs + ecore_libs,
346 )
347 ext_modules.append(dbus_ml_ext) 311 ext_modules.append(dbus_ml_ext)
348 312
349 # === Elementary === 313 # === Elementary ===
@@ -421,16 +385,13 @@ if set(("build", "build_ext", "install", "bdist", "sdist")) & set(sys.argv):
421 "window", 385 "window",
422 ) 386 )
423 387
424 elm_cflags, elm_libs = pkg_config( 388 elm_cflags, elm_libs = pkg_config('Elementary', 'elementary', ELM_MIN_VER)
425 'Elementary', 'elementary', ELM_MIN_VERSION)
426 for m in elm_mods: 389 for m in elm_mods:
427 e = Extension( 390 e = Extension("elementary." + m,
428 "elementary." + m, 391 ["efl/elementary/" + m + module_suffix],
429 ["efl/elementary/" + m + module_suffix], 392 include_dirs=["include/"],
430 include_dirs=["include/"], 393 extra_compile_args=elm_cflags + ecore_x_cflags,
431 extra_compile_args=elm_cflags + ecore_x_cflags, 394 extra_link_args=elm_libs + eina_libs + evas_libs)
432 extra_link_args=elm_libs + eina_libs + evas_libs,
433 )
434 ext_modules.append(e) 395 ext_modules.append(e)
435 396
436 packages.append("efl.elementary") 397 packages.append("efl.elementary")
@@ -477,14 +438,13 @@ setup(
477 }, 438 },
478 packages=packages, 439 packages=packages,
479 ext_package="efl", 440 ext_package="efl",
480 ext_modules=cythonize( 441 ext_modules=cythonize(ext_modules,
481 ext_modules, 442 include_path=["include"],
482 include_path=["include"], 443 compiler_directives={
483 compiler_directives={ 444 #"c_string_type": "unicode",
484 #"c_string_type": "unicode", 445 #"c_string_encoding": "utf-8",
485 #"c_string_encoding": "utf-8", 446 "embedsignature": True,
486 "embedsignature": True, 447 }
487 }
488 ), 448 ),
489 py_modules=py_modules, 449 py_modules=py_modules,
490) 450)