Permalink
Browse files

A few changes to fix reporlab dependency to be in the right way

  • Loading branch information...
1 parent 9793d0f commit 8f3a680f51e53f8cfd855f228348baa2e49631f3 @marinho committed Aug 22, 2012
Showing with 24 additions and 21 deletions.
  1. +1 −4 geraldo/__init__.py
  2. +2 −6 geraldo/base.py
  3. +1 −3 geraldo/graphics.py
  4. +13 −3 geraldo/utils.py
  5. +5 −0 geraldo/version.py
  6. +1 −4 geraldo/widgets.py
  7. +1 −1 setup.py
View
@@ -43,10 +43,7 @@
- tests - a package with automated doc tests.
"""
-VERSION = (0, 4, 15)
-
-def get_version():
- return '%d.%d.%d'%VERSION
+from version import VERSION, get_version
__author__ = 'Marinho Brandao'
__license__ = 'GNU Lesser General Public License (LGPL)'
View
@@ -5,13 +5,9 @@
except NameError:
from sets import Set as set # Python 2.3 fallback
-from reportlab.lib.units import cm
-from reportlab.lib.pagesizes import A4
-from reportlab.lib.colors import black
-from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT
-
from utils import calculate_size, get_attr_value, landscape, format_date, memoize,\
- BAND_WIDTH, BAND_HEIGHT, CROSS_COLS, CROSS_ROWS
+ BAND_WIDTH, BAND_HEIGHT, CROSS_COLS, CROSS_ROWS, cm, A4, black, TA_LEFT, TA_CENTER,\
+ TA_RIGHT
from exceptions import EmptyQueryset, ObjectNotFound, ManyObjectsFound,\
AttributeNotFound, NotYetImplemented
from cache import DEFAULT_CACHE_STATUS, CACHE_BACKEND, CACHE_FILE_ROOT
View
@@ -1,7 +1,5 @@
-from reportlab.lib.colors import black
-from reportlab.lib.units import cm
-
from base import BAND_WIDTH, BAND_HEIGHT, Element
+from utils import cm, black
class Graphic(Element):
"""Base graphic class"""
View
@@ -1,8 +1,18 @@
import sys
-from reportlab.lib.units import * # Check this - is the source of units
-from reportlab.lib.pagesizes import * # Check this - is the source of page sizes
-from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT # Check this also
+try:
+ import reportlab
+except ImportError:
+ cm = 28.346456692913385
+ A4 = (595.275590551181, 841.8897637795275)
+ black = None
+ TA_LEFT, TA_CENTER, TA_RIGHT = 0, 1, 2
+ landscape = lambda t:(t[1],t[0])
+else:
+ from reportlab.lib.units import * # Check this - is the source of units
+ from reportlab.lib.pagesizes import * # Check this - is the source of page sizes
+ from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT # Check this also
+ from reportlab.lib.colors import black
from exceptions import AttributeNotFound
View
@@ -0,0 +1,5 @@
+VERSION = (0, 4, 16)
+
+def get_version():
+ return '%d.%d.%d'%VERSION
+
View
@@ -5,13 +5,10 @@
except NameError:
from sets import Set as set # Python 2.3 fallback
-from reportlab.lib.units import cm
-from reportlab.lib.colors import black
-
from base import BAND_WIDTH, BAND_HEIGHT, Element, SubReport
from utils import get_attr_value, SYSTEM_FIELD_CHOICES, FIELD_ACTION_VALUE, FIELD_ACTION_COUNT,\
FIELD_ACTION_AVG, FIELD_ACTION_MIN, FIELD_ACTION_MAX, FIELD_ACTION_SUM,\
- FIELD_ACTION_DISTINCT_COUNT
+ FIELD_ACTION_DISTINCT_COUNT, cm, black
from exceptions import AttributeNotFound
class Widget(Element):
View
@@ -9,7 +9,7 @@
from setuptools import setup, find_packages
from setuptools import setup
-from geraldo import get_version
+from geraldo.version import get_version
setup(
name = 'Geraldo',

0 comments on commit 8f3a680

Please sign in to comment.