111 lines
4.3 KiB
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 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 instead of autotools, because that is the right way to compile python stuff. So to build just use: python install or python3 install Enjoy davemds SVN revision: 83831
2013-02-11 14:32:50 -08:00
#! /usr/bin/env python
import sys
import subprocess
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import Cython.Compiler.Options
Cython.Compiler.Options.fast_fail = True # stop compilation on first error
except ImportError:
raise SystemExit("Requires Cython (")
def pkg_config(name, require, min_vers=None):
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 ==["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):
raise SystemExit("Failed to find Evas with 'pkg-config'. Please make sure that it is installed and available on your system path.")
except (AssertionError):
raise SystemExit("Failed to match version. Found: " + ver + " Needed: " + min_vers)
## This is usefull while working on the source, to force the rebuild of modules.
#"rm -rfv efl/*/*.c", shell=True)
#"rm -rfv efl/eo/*.c", shell=True)
#"rm -rfv efl/evas/*.c", shell=True)
#"rm -rfv efl/ecore/*.c", shell=True)
#"rm -rfv efl/edje/*.c", shell=True)
#"rm -rfv efl/emotion/*.c", shell=True)
#"rm -rfv efl/elementary/*.c", shell=True)
modules = []
# Eo
eo_cflags, eo_libs = pkg_config('Eo', 'eo', "1.7.99")
eo_ext = Extension("efl.eo", ["efl/eo/efl.eo.pyx"],
include_dirs = ['include/'],
extra_compile_args = eo_cflags,
extra_link_args = eo_libs)
# Evas
evas_cflags, evas_libs = pkg_config('Evas', 'evas', "1.7.99")
evas_ext = Extension("efl.evas", ["efl/evas/efl.evas.pyx"],
include_dirs = ['include/'],
extra_compile_args = evas_cflags,
extra_link_args = evas_libs)
# Ecore
ecore_cflags, ecore_libs = pkg_config('Ecore', 'ecore', "1.7.99")
efile_cflags, efile_libs = pkg_config('EcoreFile', 'ecore-file', "1.7.99")
ecore_ext = Extension("efl.ecore", ["efl/ecore/efl.ecore.pyx"],
include_dirs = ['include/'],
extra_compile_args = ecore_cflags + efile_cflags,
extra_link_args = ecore_libs + efile_libs)
# Edje
edje_cflags, edje_libs = pkg_config('Edje', 'edje', "1.7.99")
edje_ext = Extension("efl.edje", ["efl/edje/efl.edje.pyx"],
include_dirs = ['include/'],
extra_compile_args = edje_cflags,
extra_link_args = edje_libs)
# Emotion
# emotion_cflags, emotion_libs = pkg_config('Emotion', 'emotion', "1.7.99")
# emotion_ext = Extension("efl.emotion", ["efl/emotion/efl.emotion.pyx"],
# include_dirs = ['include/'],
# extra_compile_args = emotion_cflags,
# extra_link_args = emotion_libs)
# modules.append(emotion_ext)
# Elementary
elm_cflags, elm_libs = pkg_config('Elementary', 'elementary', "1.7.99")
elm_ext = Extension("efl.elementary", ["efl/elementary/efl.elementary.pyx"],
include_dirs = ['include/'],
extra_compile_args = elm_cflags,
extra_link_args = elm_libs)
if __name__ == "__main__":
name = "efl",
version = "1.7.99",
author = "Davide <davemds> Andreoli",
author_email = "",
maintainer = "Davide <davemds> Andreoli",
maintainer_email = "",
url = "",
description = "Python bindings for the EFL stack",
license = "GNU Lesser General Public License (LGPL)",
packages = ["efl"],
cmdclass = {"build_ext": build_ext},
ext_modules = modules