setup.py cleanups: indentation
This commit is contained in:
parent
fd1167e8cc
commit
379aef8950
284
setup.py
284
setup.py
|
@ -18,15 +18,15 @@ VERSION = "%d.%d" % (vers[0], vers[1] if vers[2] < 99 else vers[1] + 1)
|
|||
|
||||
# dependencies
|
||||
CYTHON_MIN_VERSION = "0.19"
|
||||
EFL_MIN_VERSION = RELEASE
|
||||
ELM_MIN_VERSION = RELEASE
|
||||
EFL_MIN_VER = RELEASE
|
||||
ELM_MIN_VER = RELEASE
|
||||
|
||||
|
||||
# Add git commit count for dev builds
|
||||
if vers[2] == 99:
|
||||
try:
|
||||
call = subprocess.Popen(
|
||||
["git", "log", "--oneline"], stdout=subprocess.PIPE)
|
||||
call = subprocess.Popen(["git", "log", "--oneline"],
|
||||
stdout=subprocess.PIPE)
|
||||
out, err = call.communicate()
|
||||
except Exception:
|
||||
RELEASE += "a0"
|
||||
|
@ -48,8 +48,7 @@ try:
|
|||
from sphinx.setup_command import BuildDoc
|
||||
except ImportError:
|
||||
class BuildDoc(Command):
|
||||
description = \
|
||||
"build documentation using sphinx, that must be installed."
|
||||
description = "build docs using sphinx, that must be installed."
|
||||
version = ""
|
||||
release = ""
|
||||
user_options = []
|
||||
|
@ -69,22 +68,22 @@ def pkg_config(name, require, min_vers=None):
|
|||
try:
|
||||
sys.stdout.write("Checking for " + name + ": ")
|
||||
|
||||
call = subprocess.Popen(
|
||||
["pkg-config", "--modversion", require], stdout=subprocess.PIPE)
|
||||
call = subprocess.Popen(["pkg-config", "--modversion", require],
|
||||
stdout=subprocess.PIPE)
|
||||
out, err = call.communicate()
|
||||
ver = out.decode("utf-8").strip()
|
||||
|
||||
if min_vers is not None:
|
||||
assert 0 == subprocess.call(
|
||||
["pkg-config", "--atleast-version", min_vers, require])
|
||||
assert 0 == subprocess.call(["pkg-config", "--atleast-version",
|
||||
min_vers, require])
|
||||
|
||||
call = subprocess.Popen(
|
||||
["pkg-config", "--cflags", require], stdout=subprocess.PIPE)
|
||||
call = subprocess.Popen(["pkg-config", "--cflags", require],
|
||||
stdout=subprocess.PIPE)
|
||||
out, err = call.communicate()
|
||||
cflags = out.decode("utf-8").split()
|
||||
|
||||
call = subprocess.Popen(
|
||||
["pkg-config", "--libs", require], stdout=subprocess.PIPE)
|
||||
call = subprocess.Popen(["pkg-config", "--libs", require],
|
||||
stdout=subprocess.PIPE)
|
||||
out, err = call.communicate()
|
||||
libs = out.decode("utf-8").split()
|
||||
|
||||
|
@ -96,13 +95,11 @@ def pkg_config(name, require, min_vers=None):
|
|||
except (OSError, subprocess.CalledProcessError):
|
||||
raise SystemExit("Did not find " + name + " with 'pkg-config'.")
|
||||
except (AssertionError):
|
||||
raise SystemExit(
|
||||
name + " version mismatch. Found: " + ver + " Needed: " + min_vers
|
||||
)
|
||||
raise SystemExit("%s version mismatch. Found: %s Needed %s" % (
|
||||
name, ver, min_vers))
|
||||
|
||||
|
||||
# use cython or pre-generated c files
|
||||
|
||||
# === cython or pre-generated c files ===
|
||||
if os.getenv("DISABLE_CYTHON"):
|
||||
module_suffix = ".c"
|
||||
from distutils.command.build_ext import build_ext
|
||||
|
@ -116,11 +113,8 @@ else:
|
|||
import Cython.Compiler.Options
|
||||
except ImportError:
|
||||
if not os.path.exists(os.path.join(script_path, "efl/eo/efl.eo.c")):
|
||||
raise SystemExit(
|
||||
"Requires Cython >= %s (http://cython.org/)" % (
|
||||
CYTHON_MIN_VERSION
|
||||
)
|
||||
)
|
||||
raise SystemExit("Requires Cython >= %s (http://cython.org/)" % (
|
||||
CYTHON_MIN_VERSION))
|
||||
module_suffix = ".c"
|
||||
from distutils.command.build_ext import build_ext
|
||||
|
||||
|
@ -145,22 +139,19 @@ may be caused by version of Cython that's too old.""" % (
|
|||
assert LooseVersion(Cython.__version__) >= \
|
||||
LooseVersion(CYTHON_MIN_VERSION)
|
||||
except AssertionError:
|
||||
raise SystemExit(
|
||||
"Requires Cython >= %s (http://cython.org/)" % (
|
||||
CYTHON_MIN_VERSION
|
||||
)
|
||||
)
|
||||
raise SystemExit("Requires Cython >= %s (http://cython.org/)" % (
|
||||
CYTHON_MIN_VERSION))
|
||||
|
||||
# Cython 0.21.1 PyMethod_New() is broken! blacklisted
|
||||
if Cython.__version__ == "0.21.1":
|
||||
raise SystemExit("Cython 0.21.1 is broken! Use another release.")
|
||||
|
||||
Cython.Compiler.Options.fast_fail = True # Stop compilation on first
|
||||
# error
|
||||
Cython.Compiler.Options.annotate = False # Generates HTML files with
|
||||
# annotated source
|
||||
Cython.Compiler.Options.docstrings = True # Set to False to disable
|
||||
# docstrings
|
||||
# Stop compilation on first error
|
||||
Cython.Compiler.Options.fast_fail = True
|
||||
# Generates HTML files with annotated source
|
||||
Cython.Compiler.Options.annotate = False
|
||||
# Set to False to disable docstrings
|
||||
Cython.Compiler.Options.docstrings = True
|
||||
|
||||
|
||||
class CleanGenerated(Command):
|
||||
|
@ -176,14 +167,13 @@ class CleanGenerated(Command):
|
|||
def run(self):
|
||||
for lib in ("eo", "evas", "ecore", "edje", "edje/edit", "emotion",
|
||||
"elementary", "ethumb", "utils"):
|
||||
for root, dirs, files in \
|
||||
os.walk(os.path.join(script_path, "efl", lib)):
|
||||
lib_path = os.path.join(script_path, "efl", lib)
|
||||
for root, dirs, files in os.walk(lib_path):
|
||||
for f in files:
|
||||
if f.endswith(".c") or f.endswith(".html"):
|
||||
path = os.path.join(root, f)
|
||||
os.remove(path)
|
||||
dbus_ml_path = os.path.join(
|
||||
script_path, "efl", "dbus_mainloop", "dbus_mainloop.c")
|
||||
os.remove(os.path.join(root, f))
|
||||
dbus_ml_path = os.path.join(script_path, "efl", "dbus_mainloop",
|
||||
"dbus_mainloop.c")
|
||||
if os.path.exists(dbus_ml_path):
|
||||
os.remove(dbus_ml_path)
|
||||
|
||||
|
@ -195,155 +185,129 @@ packages = ["efl"]
|
|||
if set(("build", "build_ext", "install", "bdist", "sdist")) & set(sys.argv):
|
||||
|
||||
# === Eina ===
|
||||
eina_cflags, eina_libs = pkg_config('Eina', 'eina', EFL_MIN_VERSION)
|
||||
eina_cflags, eina_libs = pkg_config('Eina', 'eina', EFL_MIN_VER)
|
||||
|
||||
# === Eo ===
|
||||
eo_cflags, eo_libs = pkg_config('Eo', 'eo', EFL_MIN_VERSION)
|
||||
eo_ext = Extension(
|
||||
"eo", ["efl/eo/efl.eo" + module_suffix],
|
||||
define_macros=[('EFL_BETA_API_SUPPORT', None)],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=eo_cflags,
|
||||
extra_link_args=eo_libs + eina_libs
|
||||
)
|
||||
eo_cflags, eo_libs = pkg_config('Eo', 'eo', EFL_MIN_VER)
|
||||
eo_ext = Extension("eo", ["efl/eo/efl.eo" + module_suffix],
|
||||
define_macros=[('EFL_BETA_API_SUPPORT', None)],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=eo_cflags,
|
||||
extra_link_args=eo_libs + eina_libs
|
||||
)
|
||||
ext_modules.append(eo_ext)
|
||||
|
||||
# === Utilities ===
|
||||
utils_ext = [
|
||||
Extension(
|
||||
"utils.deprecated", ["efl/utils/deprecated" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=eina_cflags,
|
||||
extra_link_args=eina_libs
|
||||
),
|
||||
Extension(
|
||||
"utils.conversions", ["efl/utils/conversions" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=eo_cflags,
|
||||
extra_link_args=eo_libs + eina_libs,
|
||||
),
|
||||
Extension(
|
||||
"utils.logger", ["efl/utils/logger" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=eina_cflags,
|
||||
extra_link_args=eina_libs,
|
||||
),
|
||||
Extension("utils.deprecated", ["efl/utils/deprecated" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=eina_cflags,
|
||||
extra_link_args=eina_libs),
|
||||
Extension("utils.conversions", ["efl/utils/conversions" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=eo_cflags,
|
||||
extra_link_args=eo_libs + eina_libs),
|
||||
Extension("utils.logger", ["efl/utils/logger" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=eina_cflags,
|
||||
extra_link_args=eina_libs),
|
||||
]
|
||||
ext_modules.extend(utils_ext)
|
||||
py_modules.append("efl.utils.setup")
|
||||
packages.append("efl.utils")
|
||||
|
||||
# === Evas ===
|
||||
evas_cflags, evas_libs = pkg_config('Evas', 'evas', EFL_MIN_VERSION)
|
||||
evas_ext = Extension(
|
||||
"evas", ["efl/evas/efl.evas" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=evas_cflags,
|
||||
extra_link_args=evas_libs + eina_libs,
|
||||
)
|
||||
evas_cflags, evas_libs = pkg_config('Evas', 'evas', EFL_MIN_VER)
|
||||
evas_ext = Extension("evas", ["efl/evas/efl.evas" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=evas_cflags,
|
||||
extra_link_args=evas_libs + eina_libs)
|
||||
ext_modules.append(evas_ext)
|
||||
|
||||
# === Ecore ===
|
||||
ecore_cflags, ecore_libs = pkg_config('Ecore', 'ecore', EFL_MIN_VERSION)
|
||||
ecore_cflags, ecore_libs = pkg_config('Ecore', 'ecore', EFL_MIN_VER)
|
||||
ecore_file_cflags, ecore_file_libs = pkg_config(
|
||||
'EcoreFile', 'ecore-file', EFL_MIN_VERSION)
|
||||
'EcoreFile', 'ecore-file', EFL_MIN_VER)
|
||||
ecore_exts = [
|
||||
Extension(
|
||||
"ecore.__init__", ["efl/ecore/__init__" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=list(set(ecore_cflags + ecore_file_cflags)),
|
||||
extra_link_args=ecore_libs + ecore_file_libs + eina_libs +
|
||||
evas_libs
|
||||
),
|
||||
Extension("ecore.__init__", ["efl/ecore/__init__" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=list(set(ecore_cflags + ecore_file_cflags)),
|
||||
extra_link_args=ecore_libs + ecore_file_libs + eina_libs +
|
||||
evas_libs),
|
||||
]
|
||||
try:
|
||||
ecore_input_cflags, ecore_input_libs = pkg_config(
|
||||
'EcoreInput', 'ecore-input', EFL_MIN_VERSION)
|
||||
'EcoreInput', 'ecore-input', EFL_MIN_VER)
|
||||
ecore_x_cflags, ecore_x_libs = pkg_config(
|
||||
'EcoreX', 'ecore-x', EFL_MIN_VERSION)
|
||||
'EcoreX', 'ecore-x', EFL_MIN_VER)
|
||||
except SystemExit: # FIXME: Change pkg-config to return a value
|
||||
pass
|
||||
else:
|
||||
ecore_exts.append(
|
||||
Extension(
|
||||
"ecore.x", ["efl/ecore/x" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=
|
||||
list(set(
|
||||
ecore_cflags + ecore_file_cflags + ecore_x_cflags +
|
||||
ecore_input_cflags
|
||||
)),
|
||||
extra_link_args=
|
||||
ecore_libs + ecore_file_libs + ecore_x_libs +
|
||||
ecore_input_libs +
|
||||
eina_libs + evas_libs,
|
||||
)
|
||||
)
|
||||
Extension("ecore.x", ["efl/ecore/x" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=list(set(ecore_cflags +
|
||||
ecore_file_cflags +
|
||||
ecore_x_cflags +
|
||||
ecore_input_cflags)),
|
||||
extra_link_args=ecore_libs + ecore_file_libs +
|
||||
ecore_x_libs + ecore_input_libs +
|
||||
eina_libs + evas_libs)
|
||||
)
|
||||
ext_modules.extend(ecore_exts)
|
||||
packages.append("efl.ecore")
|
||||
|
||||
# === Ethumb ===
|
||||
ethumb_cflags, ethumb_libs = pkg_config(
|
||||
'Ethumb', 'ethumb', EFL_MIN_VERSION)
|
||||
ethumb_ext = Extension(
|
||||
"ethumb", ["efl/ethumb/efl.ethumb" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=ethumb_cflags,
|
||||
extra_link_args=ethumb_libs + eina_libs,
|
||||
)
|
||||
ethumb_cflags, ethumb_libs = pkg_config('Ethumb', 'ethumb', EFL_MIN_VER)
|
||||
ethumb_ext = Extension("ethumb", ["efl/ethumb/efl.ethumb" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=ethumb_cflags,
|
||||
extra_link_args=ethumb_libs + eina_libs)
|
||||
ext_modules.append(ethumb_ext)
|
||||
|
||||
ethumb_client_cflags, ethumb_client_libs = pkg_config(
|
||||
'Ethumb_Client', 'ethumb_client', EFL_MIN_VERSION)
|
||||
ethumb_client_ext = Extension(
|
||||
"ethumb_client", ["efl/ethumb/efl.ethumb_client" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=ethumb_client_cflags,
|
||||
extra_link_args=ethumb_client_libs + eina_libs,
|
||||
)
|
||||
'Ethumb_Client', 'ethumb_client', EFL_MIN_VER)
|
||||
ethumb_client_ext = Extension("ethumb_client",
|
||||
["efl/ethumb/efl.ethumb_client" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=ethumb_client_cflags,
|
||||
extra_link_args=ethumb_client_libs + eina_libs)
|
||||
ext_modules.append(ethumb_client_ext)
|
||||
|
||||
# === Edje ===
|
||||
edje_cflags, edje_libs = pkg_config('Edje', 'edje', EFL_MIN_VERSION)
|
||||
edje_ext = Extension(
|
||||
"edje", ["efl/edje/efl.edje" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=edje_cflags,
|
||||
extra_link_args=edje_libs + eina_libs + evas_libs,
|
||||
)
|
||||
edje_cflags, edje_libs = pkg_config('Edje', 'edje', EFL_MIN_VER)
|
||||
edje_ext = Extension("edje", ["efl/edje/efl.edje" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=edje_cflags,
|
||||
extra_link_args=edje_libs + eina_libs + evas_libs)
|
||||
ext_modules.append(edje_ext)
|
||||
|
||||
# --- Edje_Edit ---
|
||||
edje_edit_ext = Extension(
|
||||
"edje_edit", ["efl/edje/efl.edje_edit" + module_suffix],
|
||||
define_macros=[('EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT', None)],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=edje_cflags,
|
||||
extra_link_args=edje_libs + eina_libs + evas_libs,
|
||||
)
|
||||
edje_edit_ext = Extension("edje_edit",
|
||||
["efl/edje/efl.edje_edit" + module_suffix],
|
||||
define_macros=[('EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT', None)],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=edje_cflags,
|
||||
extra_link_args=edje_libs + eina_libs + evas_libs)
|
||||
ext_modules.append(edje_edit_ext)
|
||||
|
||||
# === Emotion ===
|
||||
emotion_cflags, emotion_libs = pkg_config(
|
||||
'Emotion', 'emotion', EFL_MIN_VERSION)
|
||||
emotion_ext = Extension(
|
||||
"emotion", ["efl/emotion/efl.emotion" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=emotion_cflags,
|
||||
extra_link_args=emotion_libs +
|
||||
eina_libs + evas_libs,
|
||||
)
|
||||
emotion_cflags, emotion_libs = pkg_config('Emotion', 'emotion', EFL_MIN_VER)
|
||||
emotion_ext = Extension("emotion",
|
||||
["efl/emotion/efl.emotion" + module_suffix],
|
||||
include_dirs=['include/'],
|
||||
extra_compile_args=emotion_cflags,
|
||||
extra_link_args=emotion_libs +
|
||||
eina_libs + evas_libs)
|
||||
ext_modules.append(emotion_ext)
|
||||
|
||||
# === dbus mainloop integration ===
|
||||
dbus_cflags, dbus_libs = pkg_config('DBus', 'dbus-python', "0.83.0")
|
||||
dbus_ml_ext = Extension(
|
||||
"dbus_mainloop",
|
||||
["efl/dbus_mainloop/dbus_mainloop" + module_suffix,
|
||||
"efl/dbus_mainloop/e_dbus.c"],
|
||||
extra_compile_args=list(set(dbus_cflags + ecore_cflags)),
|
||||
extra_link_args=dbus_libs + ecore_libs,
|
||||
)
|
||||
dbus_ml_ext = Extension("dbus_mainloop",
|
||||
["efl/dbus_mainloop/dbus_mainloop" + module_suffix,
|
||||
"efl/dbus_mainloop/e_dbus.c"],
|
||||
extra_compile_args=list(set(dbus_cflags + ecore_cflags)),
|
||||
extra_link_args=dbus_libs + ecore_libs)
|
||||
ext_modules.append(dbus_ml_ext)
|
||||
|
||||
# === Elementary ===
|
||||
|
@ -421,16 +385,13 @@ if set(("build", "build_ext", "install", "bdist", "sdist")) & set(sys.argv):
|
|||
"window",
|
||||
)
|
||||
|
||||
elm_cflags, elm_libs = pkg_config(
|
||||
'Elementary', 'elementary', ELM_MIN_VERSION)
|
||||
elm_cflags, elm_libs = pkg_config('Elementary', 'elementary', ELM_MIN_VER)
|
||||
for m in elm_mods:
|
||||
e = Extension(
|
||||
"elementary." + m,
|
||||
["efl/elementary/" + m + module_suffix],
|
||||
include_dirs=["include/"],
|
||||
extra_compile_args=elm_cflags + ecore_x_cflags,
|
||||
extra_link_args=elm_libs + eina_libs + evas_libs,
|
||||
)
|
||||
e = Extension("elementary." + m,
|
||||
["efl/elementary/" + m + module_suffix],
|
||||
include_dirs=["include/"],
|
||||
extra_compile_args=elm_cflags + ecore_x_cflags,
|
||||
extra_link_args=elm_libs + eina_libs + evas_libs)
|
||||
ext_modules.append(e)
|
||||
|
||||
packages.append("efl.elementary")
|
||||
|
@ -477,14 +438,13 @@ setup(
|
|||
},
|
||||
packages=packages,
|
||||
ext_package="efl",
|
||||
ext_modules=cythonize(
|
||||
ext_modules,
|
||||
include_path=["include"],
|
||||
compiler_directives={
|
||||
#"c_string_type": "unicode",
|
||||
#"c_string_encoding": "utf-8",
|
||||
"embedsignature": True,
|
||||
}
|
||||
ext_modules=cythonize(ext_modules,
|
||||
include_path=["include"],
|
||||
compiler_directives={
|
||||
#"c_string_type": "unicode",
|
||||
#"c_string_encoding": "utf-8",
|
||||
"embedsignature": True,
|
||||
}
|
||||
),
|
||||
py_modules=py_modules,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue