Skip to content

Commit

Permalink
first beginnings of platform-specific framework; disable Cython code …
Browse files Browse the repository at this point in the history
…on win32
  • Loading branch information
njsmith committed Aug 1, 2010
1 parent 60bd68a commit 1ab210f
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 25 deletions.
2 changes: 2 additions & 0 deletions .hgignore
Expand Up @@ -7,3 +7,5 @@
^xpra/wait_for_x_server.c$
__init__\.pyc$
~$
xpra/platform/win32.pyc$
xpra/platform/posix.pyc$
60 changes: 35 additions & 25 deletions setup.py
Expand Up @@ -15,20 +15,9 @@

from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import commands, os, sys

from Cython.Compiler.Version import version as cython_version_string
cython_version = [int(part) for part in cython_version_string.split(".")]
# This was when the 'for 0 < i < 10:' syntax as added, bump upwards as
# necessary:
NEEDED_CYTHON = (0, 9, 7)
if tuple(cython_version) < NEEDED_CYTHON:
sys.exit("ERROR: Your version of Cython is too old to build this package\n"
"You have version %s\n"
"Please upgrade to Cython %s or better"
% (cython_version_string,
".".join([str(part) for part in NEEDED_CYTHON])))
from xpra.platform import HAVE_X

# Tweaked from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502261
def pkgconfig(*packages, **kw):
Expand All @@ -48,6 +37,38 @@ def pkgconfig(*packages, **kw):
kw[k] = list(set(v))
return kw

if HAVE_X:
from Cython.Distutils import build_ext
from Cython.Compiler.Version import version as cython_version_string
cython_version = [int(part) for part in cython_version_string.split(".")]
# This was when the 'for 0 < i < 10:' syntax as added, bump upwards as
# necessary:
NEEDED_CYTHON = (0, 9, 7)
if tuple(cython_version) < NEEDED_CYTHON:
sys.exit("ERROR: Your version of Cython is too old to build this package\n"
"You have version %s\n"
"Please upgrade to Cython %s or better"
% (cython_version_string,
".".join([str(part) for part in NEEDED_CYTHON])))

ext_modules = [
Extension("wimpiggy.lowlevel.bindings",
["wimpiggy/lowlevel/bindings.pyx"],
**pkgconfig("pygobject-2.0", "gdk-x11-2.0", "gtk+-x11-2.0",
"xtst", "xfixes", "xcomposite", "xdamage")
),
Extension("xpra.wait_for_x_server",
["xpra/wait_for_x_server.pyx"],
**pkgconfig("x11")
),
]

cmdclass = {'build_ext': build_ext}
else:
ext_modules = []
cmdclass = {}


import wimpiggy
import parti
import xpra
Expand Down Expand Up @@ -82,17 +103,6 @@ def pkgconfig(*packages, **kw):
"scripts/xpra",
],
data_files = [("share/man/man1", ["xpra.1"])],
ext_modules=[
Extension("wimpiggy.lowlevel.bindings",
["wimpiggy/lowlevel/bindings.pyx"],
**pkgconfig("pygobject-2.0", "gdk-x11-2.0", "gtk+-x11-2.0",
"xtst", "xfixes", "xcomposite", "xdamage")
),
Extension("xpra.wait_for_x_server",
["xpra/wait_for_x_server.pyx"],
**pkgconfig("x11")
),
],
# Turn on Cython-sensitivity:
cmdclass = {'build_ext': build_ext}
ext_modules=ext_modules,
cmdclass=cmdclass,
)
8 changes: 8 additions & 0 deletions xpra/platform/__init__.py
@@ -0,0 +1,8 @@
import os as _os
if _os.name == "nt":
from xpra.platform.win32 import *
elif _os.name == "posix":
from xpra.platform.posix import *
else:
raise OSError, "Unknown OS %s" % (_os.name)

1 change: 1 addition & 0 deletions xpra/platform/posix.py
@@ -0,0 +1 @@
HAVE_X = True
1 change: 1 addition & 0 deletions xpra/platform/win32.py
@@ -0,0 +1 @@
HAVE_X = False

0 comments on commit 1ab210f

Please sign in to comment.