Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-04-17 13:20:35 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-04-17 13:20:35 (GMT)
commitccca798196b9eef3e08c93826f4d4f8f4f85327e (patch)
tree4448b1c482622bf84aa7205fe2efb917ba7d203d
parent192750ecf53a180fc2dba141b4d149ce5abf9bf4 (diff)
Add binary blobs selector
-rw-r--r--.gitignore4
-rwxr-xr-x_camera.sobin32196 -> 0 bytes
-rw-r--r--camerac/Makefile (renamed from Makefile)22
-rw-r--r--camerac/__init__.py21
-rw-r--r--camerac/camera.c (renamed from _camera.c)6
-rw-r--r--constants.py4
-rw-r--r--ui.py8
-rw-r--r--utils.py4
8 files changed, 47 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index 5d1e468..627bf19 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
-_camera.o
+*.o
+*.so
+linux*
dist
locale
diff --git a/_camera.so b/_camera.so
deleted file mode 100755
index ec00d95..0000000
--- a/_camera.so
+++ /dev/null
Binary files differ
diff --git a/Makefile b/camerac/Makefile
index 265b3ee..ce80618 100644
--- a/Makefile
+++ b/camerac/Makefile
@@ -17,20 +17,22 @@ PYCAIRO_INCLUDES=`pkg-config --cflags pycairo`
PYCAIRO_LIBS=`pkg-config --libs pycairo`
INCLUDES=-I. -I/usr/include/${PYTHON} ${GLIB_INCLUDES} ${PYGTK_INCLUDES} ${CAIRO_INCLUDES} ${PYCAIRO_INCLUDES} ${GTK_INCLUDES}
-ARCHFLAGS=-m32 -march=i386 -mtune=generic
OPTFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -fasynchronous-unwind-tables
-CFLAGS=-g -fPIC -DPIC
-LDFLAGS=-shared -nostdlib -Wl,--export-dynamic -pthread
+CFLAGS=-g -fPIC -DPIC $(OPTFLAGS) $(INCLUDES)
+LDFLAGS=-shared -nostdlib -Wl,--export-dynamic -pthread ${GLIB_LIBS} ${PYGTK_LIBS} ${CAIRO_LIBS} ${PYCAIRO_LIBS} ${GTK_LIBS}
-all: build link
+ARCH = $(shell arch | grep 64 >/dev/null && echo linux64 || echo linux32)
+LIB_DIR = $(ARCH)_$(PYVER)
-build: _camera.o
-_camera.o: _camera.c
- gcc ${INCLUDES} ${ARCHFLAGS} ${OPTFLAGS} ${CFLAGS} -c _camera.c -o _camera.o
+all: camera.so
+ rm -rf $(LIB_DIR)
+ mkdir $(LIB_DIR)
+ strip -s $^
+ mv $^ $(LIB_DIR)/
+ touch $(LIB_DIR)/__init__.py
-link: _camera.so
-_camera.so: _camera.o
- g++ ${LDFLAGS} _camera.o ${GLIB_LIBS} ${PYGTK_LIBS} ${CAIRO_LIBS} ${PYCAIRO_LIBS} ${GTK_LIBS} -Wl,-soname -Wl,_camera.so -o _camera.so
+camera.so: camera.o
+ $(CXX) $(LDFLAGS) -o $@ $^
clean:
@find -name "*.o" -exec rm {} \;
diff --git a/camerac/__init__.py b/camerac/__init__.py
new file mode 100644
index 0000000..dba55ae
--- /dev/null
+++ b/camerac/__init__.py
@@ -0,0 +1,21 @@
+import os
+import sys
+import logging
+
+_sys_path = sys.path
+_root_path = os.path.dirname(__file__)
+
+for i in os.listdir(_root_path):
+ path = os.path.join(_root_path, i)
+ if (os.path.isdir(path)):
+ sys.path = _sys_path + [os.path.join('.', path)]
+ try:
+ from camera import *
+ logging.debug('use %s blobs' % path)
+ _sys_path = None
+ break
+ except Exception, e:
+ logging.debug('skip %s blobs: %s' % (path, e))
+
+if _sys_path:
+ raise('cannot find proper binary blobs')
diff --git a/_camera.c b/camerac/camera.c
index 694f0a4..cf4795d 100644
--- a/_camera.c
+++ b/camerac/camera.c
@@ -260,17 +260,17 @@ py_camera_register_classes(PyObject *d)
}
DL_EXPORT(void)
-init_camera(void)
+initcamera(void)
{
PyObject *m, *d;
Pycairo_IMPORT;
- m = Py_InitModule ("_camera", py_camera_functions);
+ m = Py_InitModule ("camera", py_camera_functions);
d = PyModule_GetDict (m);
py_camera_register_classes (d);
if (PyErr_Occurred ()) {
- Py_FatalError ("can't initialise module _camera");
+ Py_FatalError ("can't initialise module camera");
}
}
diff --git a/constants.py b/constants.py
index 64fbc4f..e24227d 100644
--- a/constants.py
+++ b/constants.py
@@ -10,7 +10,7 @@ from instance import Instance
from sugar import profile
from color import Color
import utils
-import _camera
+import camerac
import cairo
import pango
import pangocairo
@@ -269,7 +269,7 @@ class Constants:
recCircleFile = os.path.join(self.__class__.gfxPath, 'media-circle.png')
recCirclePixbuf = gtk.gdk.pixbuf_new_from_file(recCircleFile)
- self.__class__.recCircleCairo = _camera.cairo_surface_from_gdk_pixbuf(recCirclePixbuf)
+ self.__class__.recCircleCairo = camerac.cairo_surface_from_gdk_pixbuf(recCirclePixbuf)
recInsFile = os.path.join(self.__class__.gfxPath, 'media-insensitive.png')
recInsPixbuf = gtk.gdk.pixbuf_new_from_file(recInsFile)
diff --git a/ui.py b/ui.py
index d1a6726..6f715f4 100644
--- a/ui.py
+++ b/ui.py
@@ -56,7 +56,7 @@ from recorded import Recorded
from button import RecdButton
import utils
import record
-import _camera
+import camerac
from tray import HTray
from toolbarcombobox import ToolComboBox
@@ -739,7 +739,7 @@ class UI:
if (pixbuf != None):
#self.shownRecd = recd
- img = _camera.cairo_surface_from_gdk_pixbuf(pixbuf)
+ img = camerac.cairo_surface_from_gdk_pixbuf(pixbuf)
self.livePhotoCanvas.setImage( img )
self.LIVEMODE = False
@@ -1599,7 +1599,7 @@ class UI:
#if (recd != self.shownRecd):
pixbuf = recd.getAudioImagePixbuf()
- img = _camera.cairo_surface_from_gdk_pixbuf(pixbuf)
+ img = camerac.cairo_surface_from_gdk_pixbuf(pixbuf)
self.livePhotoCanvas.setImage( img )
#self.shownRecd = recd
self.showRecdMeta(recd)
@@ -1708,7 +1708,7 @@ class UI:
pixbuf = pixbuf.scale_simple(self.__class__.dim_THUMB_WIDTH, self.__class__.dim_THUMB_HEIGHT, gtk.gdk.INTERP_NEAREST)
pixbuf = utils.grayScalePixBuf(pixbuf, True)
- img = _camera.cairo_surface_from_gdk_pixbuf(pixbuf)
+ img = camerac.cairo_surface_from_gdk_pixbuf(pixbuf)
self.backgdCanvas.setImage(img)
diff --git a/utils.py b/utils.py
index 7244ab0..d91633c 100644
--- a/utils.py
+++ b/utils.py
@@ -11,7 +11,7 @@ import time
from time import strftime
from sugar import util
-import _camera
+import camerac
def getStringFromPixbuf(pixbuf):
data = [""]
@@ -68,7 +68,7 @@ def generateThumbnail( pixbuf, scale, thumbw, thumbh ):
#need to generate thumbnail version here
thumbImg = cairo.ImageSurface(cairo.FORMAT_ARGB32, thumbw, thumbh)
tctx = cairo.Context(thumbImg)
- img = _camera.cairo_surface_from_gdk_pixbuf(pixbuf)
+ img = camerac.cairo_surface_from_gdk_pixbuf(pixbuf)
tctx.scale(scale, scale)
tctx.set_source_surface(img, 0, 0)
tctx.paint()