python-efl/setup.py

368 lines
12 KiB
Python
Raw Normal View History

Put in a first, still wip, version of the python bindings in a merged tree. This is meant to be the 1.8 version of the wrappers and will include everything that now is in the python folder. Atm this include evas, ecore, edje, elementary and emotion (emotion still commented in the build couse it need some more testing). Eo is used as a base for all the objects that inherit from it in C, but in real nothing is used from Eo, it is used more like a container to share code between the libs. All the docs has been stripped out because we want to use the new sphinx style docs that Kay has done in his git repo. (Kay: please wait a little bit to include it, as working on the libs without docs is much more easy) The new wrappers include a new container module called efl and thus you can live with both the old and the new installation. This also means that you need to import the new modules as: "from efl import evas" (instead of the old "import evas") The idea here is that you can make your code works with both version doing something like: try: import evas except: from efl import evas ...like is done in the gtk bindings Some stuff has been leaved out on purpose, because was old stuff (like the hacked evas rotation stuff) or because was not working as expected (like all the ecore.evas.XXX modules). See the TODO.txt file for more info. Probably some stuff is out just because I missed them, let me know if you miss something. Improvements from the old version: - Py3 compatible (still some work to be done, but really only TODO, no problems to resolv) - Should also works on other platforms, like windoz (but not tested) - Unittests greatly improved, you can also run ALL tests at once - much more simpler :) I will contine the works in the next weeks and hope someone will help too. NOTE: I switched back to setup.py instead of autotools, because that is the right way to compile python stuff. So to build just use: python setup.py install or python3 setup.py install Enjoy davemds SVN revision: 83831
2013-02-11 14:32:50 -08:00
#! /usr/bin/env python
# encoding: utf-8
Put in a first, still wip, version of the python bindings in a merged tree. This is meant to be the 1.8 version of the wrappers and will include everything that now is in the python folder. Atm this include evas, ecore, edje, elementary and emotion (emotion still commented in the build couse it need some more testing). Eo is used as a base for all the objects that inherit from it in C, but in real nothing is used from Eo, it is used more like a container to share code between the libs. All the docs has been stripped out because we want to use the new sphinx style docs that Kay has done in his git repo. (Kay: please wait a little bit to include it, as working on the libs without docs is much more easy) The new wrappers include a new container module called efl and thus you can live with both the old and the new installation. This also means that you need to import the new modules as: "from efl import evas" (instead of the old "import evas") The idea here is that you can make your code works with both version doing something like: try: import evas except: from efl import evas ...like is done in the gtk bindings Some stuff has been leaved out on purpose, because was old stuff (like the hacked evas rotation stuff) or because was not working as expected (like all the ecore.evas.XXX modules). See the TODO.txt file for more info. Probably some stuff is out just because I missed them, let me know if you miss something. Improvements from the old version: - Py3 compatible (still some work to be done, but really only TODO, no problems to resolv) - Should also works on other platforms, like windoz (but not tested) - Unittests greatly improved, you can also run ALL tests at once - much more simpler :) I will contine the works in the next weeks and hope someone will help too. NOTE: I switched back to setup.py instead of autotools, because that is the right way to compile python stuff. So to build just use: python setup.py install or python3 setup.py install Enjoy davemds SVN revision: 83831
2013-02-11 14:32:50 -08:00
import os
Put in a first, still wip, version of the python bindings in a merged tree. This is meant to be the 1.8 version of the wrappers and will include everything that now is in the python folder. Atm this include evas, ecore, edje, elementary and emotion (emotion still commented in the build couse it need some more testing). Eo is used as a base for all the objects that inherit from it in C, but in real nothing is used from Eo, it is used more like a container to share code between the libs. All the docs has been stripped out because we want to use the new sphinx style docs that Kay has done in his git repo. (Kay: please wait a little bit to include it, as working on the libs without docs is much more easy) The new wrappers include a new container module called efl and thus you can live with both the old and the new installation. This also means that you need to import the new modules as: "from efl import evas" (instead of the old "import evas") The idea here is that you can make your code works with both version doing something like: try: import evas except: from efl import evas ...like is done in the gtk bindings Some stuff has been leaved out on purpose, because was old stuff (like the hacked evas rotation stuff) or because was not working as expected (like all the ecore.evas.XXX modules). See the TODO.txt file for more info. Probably some stuff is out just because I missed them, let me know if you miss something. Improvements from the old version: - Py3 compatible (still some work to be done, but really only TODO, no problems to resolv) - Should also works on other platforms, like windoz (but not tested) - Unittests greatly improved, you can also run ALL tests at once - much more simpler :) I will contine the works in the next weeks and hope someone will help too. NOTE: I switched back to setup.py instead of autotools, because that is the right way to compile python stuff. So to build just use: python setup.py install or python3 setup.py install Enjoy davemds SVN revision: 83831
2013-02-11 14:32:50 -08:00
import sys
import subprocess
from distutils.core import setup, Command
Put in a first, still wip, version of the python bindings in a merged tree. This is meant to be the 1.8 version of the wrappers and will include everything that now is in the python folder. Atm this include evas, ecore, edje, elementary and emotion (emotion still commented in the build couse it need some more testing). Eo is used as a base for all the objects that inherit from it in C, but in real nothing is used from Eo, it is used more like a container to share code between the libs. All the docs has been stripped out because we want to use the new sphinx style docs that Kay has done in his git repo. (Kay: please wait a little bit to include it, as working on the libs without docs is much more easy) The new wrappers include a new container module called efl and thus you can live with both the old and the new installation. This also means that you need to import the new modules as: "from efl import evas" (instead of the old "import evas") The idea here is that you can make your code works with both version doing something like: try: import evas except: from efl import evas ...like is done in the gtk bindings Some stuff has been leaved out on purpose, because was old stuff (like the hacked evas rotation stuff) or because was not working as expected (like all the ecore.evas.XXX modules). See the TODO.txt file for more info. Probably some stuff is out just because I missed them, let me know if you miss something. Improvements from the old version: - Py3 compatible (still some work to be done, but really only TODO, no problems to resolv) - Should also works on other platforms, like windoz (but not tested) - Unittests greatly improved, you can also run ALL tests at once - much more simpler :) I will contine the works in the next weeks and hope someone will help too. NOTE: I switched back to setup.py instead of autotools, because that is the right way to compile python stuff. So to build just use: python setup.py install or python3 setup.py install Enjoy davemds SVN revision: 83831
2013-02-11 14:32:50 -08:00
from distutils.extension import Extension
from distutils.version import StrictVersion
Put in a first, still wip, version of the python bindings in a merged tree. This is meant to be the 1.8 version of the wrappers and will include everything that now is in the python folder. Atm this include evas, ecore, edje, elementary and emotion (emotion still commented in the build couse it need some more testing). Eo is used as a base for all the objects that inherit from it in C, but in real nothing is used from Eo, it is used more like a container to share code between the libs. All the docs has been stripped out because we want to use the new sphinx style docs that Kay has done in his git repo. (Kay: please wait a little bit to include it, as working on the libs without docs is much more easy) The new wrappers include a new container module called efl and thus you can live with both the old and the new installation. This also means that you need to import the new modules as: "from efl import evas" (instead of the old "import evas") The idea here is that you can make your code works with both version doing something like: try: import evas except: from efl import evas ...like is done in the gtk bindings Some stuff has been leaved out on purpose, because was old stuff (like the hacked evas rotation stuff) or because was not working as expected (like all the ecore.evas.XXX modules). See the TODO.txt file for more info. Probably some stuff is out just because I missed them, let me know if you miss something. Improvements from the old version: - Py3 compatible (still some work to be done, but really only TODO, no problems to resolv) - Should also works on other platforms, like windoz (but not tested) - Unittests greatly improved, you can also run ALL tests at once - much more simpler :) I will contine the works in the next weeks and hope someone will help too. NOTE: I switched back to setup.py instead of autotools, because that is the right way to compile python stuff. So to build just use: python setup.py install or python3 setup.py install Enjoy davemds SVN revision: 83831
2013-02-11 14:32:50 -08:00
script_path = os.path.dirname(os.path.abspath(__file__))
2013-12-09 23:55:46 -08:00
CYTHON_MIN_VERSION = "0.17.0"
EFL_MIN_VERSION = "1.8.99"
ELM_MIN_VERSION = "1.8.99"
# XXX: Force default visibility. See phab T504
if os.getenv("CFLAGS") is not None and "-fvisibility=" in os.environ["CFLAGS"]:
os.environ["CFLAGS"] += " -fvisibility=default"
# === Sphinx ===
try:
from sphinx.setup_command import BuildDoc
except ImportError:
class BuildDoc(Command):
description = "build documentation using sphinx, that must be installed."
user_options = []
def initialize_options(self): pass
def finalize_options(self): pass
def run(self): print("Error: sphinx not found")
Put in a first, still wip, version of the python bindings in a merged tree. This is meant to be the 1.8 version of the wrappers and will include everything that now is in the python folder. Atm this include evas, ecore, edje, elementary and emotion (emotion still commented in the build couse it need some more testing). Eo is used as a base for all the objects that inherit from it in C, but in real nothing is used from Eo, it is used more like a container to share code between the libs. All the docs has been stripped out because we want to use the new sphinx style docs that Kay has done in his git repo. (Kay: please wait a little bit to include it, as working on the libs without docs is much more easy) The new wrappers include a new container module called efl and thus you can live with both the old and the new installation. This also means that you need to import the new modules as: "from efl import evas" (instead of the old "import evas") The idea here is that you can make your code works with both version doing something like: try: import evas except: from efl import evas ...like is done in the gtk bindings Some stuff has been leaved out on purpose, because was old stuff (like the hacked evas rotation stuff) or because was not working as expected (like all the ecore.evas.XXX modules). See the TODO.txt file for more info. Probably some stuff is out just because I missed them, let me know if you miss something. Improvements from the old version: - Py3 compatible (still some work to be done, but really only TODO, no problems to resolv) - Should also works on other platforms, like windoz (but not tested) - Unittests greatly improved, you can also run ALL tests at once - much more simpler :) I will contine the works in the next weeks and hope someone will help too. NOTE: I switched back to setup.py instead of autotools, because that is the right way to compile python stuff. So to build just use: python setup.py install or python3 setup.py install Enjoy davemds SVN revision: 83831
2013-02-11 14:32:50 -08:00
# === pkg-config ===
def pkg_config(name, require, min_vers=None):
try:
sys.stdout.write("Checking for " + name + ": ")
ver = subprocess.check_output(["pkg-config", "--modversion", require]).decode("utf-8").strip()
if min_vers is not None:
assert 0 == subprocess.call(["pkg-config", "--atleast-version", min_vers, require])
cflags = subprocess.check_output(["pkg-config", "--cflags", require]).decode("utf-8").split()
libs = subprocess.check_output(["pkg-config", "--libs", require]).decode("utf-8").split()
sys.stdout.write("OK, found " + ver + "\n")
return (cflags, libs)
except (OSError, subprocess.CalledProcessError):
print("Did not find " + name + " with 'pkg-config'.")
return None
except (AssertionError):
print(name + " version mismatch. Found: " + ver + " Needed: " + min_vers)
return None
# use cython or pre-generated c files
if os.path.exists(os.path.join(script_path, "efl", "eo", "efl.eo.pyx")):
module_suffix = ".pyx"
try:
from Cython.Distutils import build_ext
from Cython.Build import cythonize
import Cython.Compiler.Options
2013-12-09 23:55:46 -08:00
assert StrictVersion(Cython.__version__) >= StrictVersion(CYTHON_MIN_VERSION)
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
except (ImportError, AssertionError):
2013-12-09 23:55:46 -08:00
print("Requires Cython >= %s (http://cython.org/)" % CYTHON_MIN_VERSION)
raise
else:
module_suffix = ".c"
from distutils.command.build_ext import build_ext
def cythonize(modules, *args, **kwargs):
return modules
class CleanGenerated(Command):
description = "Clean C and html files generated by Cython"
user_options = []
def initialize_options(self): pass
def finalize_options(self): pass
def run(self):
for lib in "eo", "evas", "ecore", "edje", "edje/edit", "emotion", "elementary", "utils":
for root, dirs, files in os.walk(os.path.join(script_path, "efl", lib)):
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")
if os.path.exists(dbus_ml_path):
os.remove(dbus_ml_path)
modules = []
packages = ["efl"]
package_dirs = {}
if set(("build", "build_ext", "install", "bdist", "sdist")) & set(sys.argv):
# === Eina ===
2013-12-09 23:55:46 -08:00
eina_pkg_config = pkg_config('Eina', 'eina', EFL_MIN_VERSION)
if eina_pkg_config is None:
raise SystemExit("Eina required but not found!")
else:
eina_cflags, eina_libs = eina_pkg_config
# === Eo ===
2013-12-09 23:55:46 -08:00
eo_pkg_config = pkg_config('Eo', 'eo', EFL_MIN_VERSION)
if eo_pkg_config is None:
raise SystemExit("Eo required but not found!")
else:
eo_cflags, eo_libs = eo_pkg_config
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)
modules.append(eo_ext)
# === Utilities ===
utils_ext = [
2013-10-24 12:58:09 -07:00
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,
2013-10-24 12:58:09 -07:00
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),
]
modules += utils_ext
packages.append("efl.utils")
# === Evas ===
2013-12-09 23:55:46 -08:00
evas_pkg_config = pkg_config('Evas', 'evas', EFL_MIN_VERSION)
if evas_pkg_config is not None:
evas_cflags, evas_libs = evas_pkg_config
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)
modules.append(evas_ext)
# compatibility
packages.append("evas")
package_dirs["evas"] = "compat/evas"
# === Ecore ===
2013-12-09 23:55:46 -08:00
ecore_pkg_config = pkg_config('Ecore', 'ecore', EFL_MIN_VERSION)
ecore_file_pkg_config = pkg_config('EcoreFile', 'ecore-file', "1.8.0")
if ecore_pkg_config is not None and ecore_file_pkg_config is not None and evas_pkg_config is not None:
ecore_cflags, ecore_libs = ecore_pkg_config
ecore_file_cflags, ecore_file_libs = ecore_file_pkg_config
ecore_ext = Extension("ecore", ["efl/ecore/efl.ecore"+module_suffix],
include_dirs = ['include/'],
extra_compile_args = ecore_cflags + ecore_file_cflags,
extra_link_args = ecore_libs + ecore_file_libs + eina_libs + evas_libs)
modules.append(ecore_ext)
# compatibility
packages.append("ecore")
package_dirs["ecore"] = "compat/ecore"
# === Edje ===
2013-12-09 23:55:46 -08:00
edje_pkg_config = pkg_config('Edje', 'edje', EFL_MIN_VERSION)
if edje_pkg_config is not None and evas_pkg_config is not None:
edje_cflags, edje_libs = edje_pkg_config
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)
modules.append(edje_ext)
# compatibility
packages.append("edje")
package_dirs["edje"] = "compat/edje"
# === 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)
# modules.append(edje_edit_ext)
# Emotion
2013-12-09 23:55:46 -08:00
emotion_pkg_config = pkg_config('Emotion', 'emotion', EFL_MIN_VERSION)
if emotion_pkg_config is not None and evas_pkg_config is not None:
emotion_cflags, emotion_libs = emotion_pkg_config
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)
modules.append(emotion_ext)
# compatibility
packages.append("emotion")
package_dirs["emotion"] = "compat/emotion"
# === dbus mainloop integration ===
dbus_pkg_config = pkg_config('DBus', 'dbus-python', "0.83.0")
if dbus_pkg_config is not None and ecore_pkg_config is not None:
dbus_cflags, dbus_libs = dbus_pkg_config
dbus_ml_ext = Extension("dbus_mainloop",
["efl/dbus_mainloop/dbus_mainloop"+module_suffix,
"efl/dbus_mainloop/e_dbus.c"],
extra_compile_args = dbus_cflags + ecore_cflags,
extra_link_args = dbus_libs + ecore_libs)
modules.append(dbus_ml_ext)
# compatibility
packages.append("e_dbus")
package_dirs["e_dbus"] = "compat/e_dbus"
# === Elementary ===
elm_mods = (
#"access",
"actionslider",
"background",
"box",
"bubble",
"button",
"calendar_elm",
"check",
"clock",
"colorselector",
"configuration",
"conformant",
"ctxpopup",
"datetime_elm",
"dayselector",
"diskselector",
"entry",
"fileselector_button",
"fileselector_entry",
"fileselector",
"flip",
"flipselector",
"frame",
"general",
"gengrid",
"genlist",
"gesture_layer",
#"glview",
"grid",
"hover",
"hoversel",
"icon",
"image",
"index",
"innerwindow",
"label",
"layout_class",
"layout",
"list",
"mapbuf",
"map",
"menu",
"multibuttonentry",
"naviframe",
"need",
"notify",
"object_item",
"object",
"panel",
"panes",
"photocam",
"photo",
"plug",
"popup",
"progressbar",
"radio",
"scroller",
"segment_control",
"separator",
"slider",
"slideshow",
"spinner",
#"store",
"table",
"theme",
"thumb",
"toolbar",
"transit",
"video",
"web",
"window",
)
2013-12-09 23:55:46 -08:00
elm_pkg_config = pkg_config('Elementary', 'elementary', ELM_MIN_VERSION)
if elm_pkg_config is not None \
and evas_pkg_config is not None \
and ecore_pkg_config is not None \
and emotion_pkg_config is not None:
elm_cflags, elm_libs = elm_pkg_config
Put in a first, still wip, version of the python bindings in a merged tree. This is meant to be the 1.8 version of the wrappers and will include everything that now is in the python folder. Atm this include evas, ecore, edje, elementary and emotion (emotion still commented in the build couse it need some more testing). Eo is used as a base for all the objects that inherit from it in C, but in real nothing is used from Eo, it is used more like a container to share code between the libs. All the docs has been stripped out because we want to use the new sphinx style docs that Kay has done in his git repo. (Kay: please wait a little bit to include it, as working on the libs without docs is much more easy) The new wrappers include a new container module called efl and thus you can live with both the old and the new installation. This also means that you need to import the new modules as: "from efl import evas" (instead of the old "import evas") The idea here is that you can make your code works with both version doing something like: try: import evas except: from efl import evas ...like is done in the gtk bindings Some stuff has been leaved out on purpose, because was old stuff (like the hacked evas rotation stuff) or because was not working as expected (like all the ecore.evas.XXX modules). See the TODO.txt file for more info. Probably some stuff is out just because I missed them, let me know if you miss something. Improvements from the old version: - Py3 compatible (still some work to be done, but really only TODO, no problems to resolv) - Should also works on other platforms, like windoz (but not tested) - Unittests greatly improved, you can also run ALL tests at once - much more simpler :) I will contine the works in the next weeks and hope someone will help too. NOTE: I switched back to setup.py instead of autotools, because that is the right way to compile python stuff. So to build just use: python setup.py install or python3 setup.py install Enjoy davemds SVN revision: 83831
2013-02-11 14:32:50 -08:00
for m in elm_mods:
e = Extension(
"elementary." + m,
["efl/elementary/" + m + module_suffix],
include_dirs = ["include/"],
extra_compile_args = elm_cflags,
extra_link_args = elm_libs + eina_libs + evas_libs
)
modules.append(e)
packages.append("efl.elementary")
# compatibility
packages.append("elementary")
package_dirs["elementary"] = "compat/elementary"
Put in a first, still wip, version of the python bindings in a merged tree. This is meant to be the 1.8 version of the wrappers and will include everything that now is in the python folder. Atm this include evas, ecore, edje, elementary and emotion (emotion still commented in the build couse it need some more testing). Eo is used as a base for all the objects that inherit from it in C, but in real nothing is used from Eo, it is used more like a container to share code between the libs. All the docs has been stripped out because we want to use the new sphinx style docs that Kay has done in his git repo. (Kay: please wait a little bit to include it, as working on the libs without docs is much more easy) The new wrappers include a new container module called efl and thus you can live with both the old and the new installation. This also means that you need to import the new modules as: "from efl import evas" (instead of the old "import evas") The idea here is that you can make your code works with both version doing something like: try: import evas except: from efl import evas ...like is done in the gtk bindings Some stuff has been leaved out on purpose, because was old stuff (like the hacked evas rotation stuff) or because was not working as expected (like all the ecore.evas.XXX modules). See the TODO.txt file for more info. Probably some stuff is out just because I missed them, let me know if you miss something. Improvements from the old version: - Py3 compatible (still some work to be done, but really only TODO, no problems to resolv) - Should also works on other platforms, like windoz (but not tested) - Unittests greatly improved, you can also run ALL tests at once - much more simpler :) I will contine the works in the next weeks and hope someone will help too. NOTE: I switched back to setup.py instead of autotools, because that is the right way to compile python stuff. So to build just use: python setup.py install or python3 setup.py install Enjoy davemds SVN revision: 83831
2013-02-11 14:32:50 -08:00
setup(
name = "python-efl",
fullname = "Python bindings for Enlightenment Foundation Libraries",
description = "Python bindings for Enlightenment Foundation Libraries",
2013-12-09 23:55:46 -08:00
version = "1.8.99",
author = "Gustavo Sverzut Barbieri, Simon Busch, Boris 'billiob' Faure, Davide 'davemds' Andreoli, Fabiano Fidêncio, Bruno Dilly, Tiago Falcão, Joost Albers, Kai Huuhko, Ulisses Furquim",
author_email = "dave@gurumeditation.it, kai.huuhko@gmail.com",
maintainer = "Kai Huuhko, Davide <davemds> Andreoli",
maintainer_email = "kai.huuhko@gmail.com, dave@gurumeditation.it",
contact = "Enlightenment developer mailing list",
contact_email = "enlightenment-devel@lists.sourceforge.net",
url = "http://www.enlightenment.org",
license = "GNU Lesser General Public License (LGPL)",
cmdclass = {
'build_ext': build_ext,
'build_doc': BuildDoc,
'clean_generated_files': CleanGenerated
},
package_dir = package_dirs,
packages = packages,
ext_package = "efl", # The prefix for ext modules/packages
ext_modules = cythonize(modules, include_path=["include"]),
)