Skip to content

Commit 2d2b097

Browse files
committed
add recipes for pyrxp & reportlab
1 parent 2a7dc16 commit 2d2b097

File tree

3 files changed

+135
-0
lines changed

3 files changed

+135
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from pythonforandroid.toolchain import CompiledComponentsPythonRecipe, warning
2+
class PyRXPURecipe(CompiledComponentsPythonRecipe):
3+
version = '2a02cecc87b9'
4+
url = 'https://bitbucket.org/rptlab/pyrxp/get/{version}.tar.gz'
5+
depends = ['python2']
6+
patches = []
7+
8+
recipe = PyRXPURecipe()
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import os, sh
2+
from pythonforandroid.toolchain import CompiledComponentsPythonRecipe, warning
3+
from pythonforandroid.util import (urlretrieve, current_directory, ensure_dir)
4+
from pythonforandroid.logger import (logger, info, warning, error, debug, shprint, info_main)
5+
class ReportLabRecipe(CompiledComponentsPythonRecipe):
6+
version = 'c088826211ca'
7+
url = 'https://bitbucket.org/rptlab/reportlab/get/{version}.tar.gz'
8+
depends = ['python2','freetype']
9+
10+
def prebuild_arch(self, arch):
11+
if not self.is_patched(arch):
12+
super(ReportLabRecipe, self).prebuild_arch(arch)
13+
self.apply_patch('patches/fix-setup.patch',arch.arch)
14+
recipe_dir = self.get_build_dir(arch.arch)
15+
ft = self.get_recipe('freetype',self.ctx)
16+
ft_dir = ft.get_build_dir(arch.arch)
17+
ft_lib_dir = os.environ.get('_FT_LIB_',os.path.join(ft_dir,'objs','.libs'))
18+
ft_inc_dir = os.environ.get('_FT_INC_',os.path.join(ft_dir,'include'))
19+
tmp_dir = os.path.normpath(os.path.join(recipe_dir,"..","..","tmp"))
20+
info('reportlab recipe: recipe_dir={}'.format(recipe_dir))
21+
info('reportlab recipe: tmp_dir={}'.format(tmp_dir))
22+
info('reportlab recipe: ft_dir={}'.format(ft_dir))
23+
info('reportlab recipe: ft_lib_dir={}'.format(ft_lib_dir))
24+
info('reportlab recipe: ft_inc_dir={}'.format(ft_inc_dir))
25+
with current_directory(recipe_dir):
26+
sh.ls('-lathr')
27+
ensure_dir(tmp_dir)
28+
pfbfile = os.path.join(tmp_dir,"pfbfer-20070710.zip")
29+
if not os.path.isfile(pfbfile):
30+
sh.wget("http://www.reportlab.com/ftp/pfbfer-20070710.zip", "-O", pfbfile)
31+
sh.unzip("-u", "-d", os.path.join(recipe_dir, "src", "reportlab", "fonts"), pfbfile)
32+
if os.path.isfile("setup.py"):
33+
with open('setup.py','rb') as f:
34+
text = f.read().replace('_FT_LIB_',ft_lib_dir).replace('_FT_INC_',ft_inc_dir)
35+
with open('setup.py','wb') as f:
36+
f.write(text)
37+
38+
recipe = ReportLabRecipe()
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
diff -r 9ecdf084933c setup.py
2+
--- a/setup.py Wed May 13 14:09:03 2015 +0100
3+
+++ b/setup.py Fri May 22 10:14:29 2015 +0100
4+
@@ -14,8 +14,8 @@
5+
#no-download-t1-files=yes
6+
#ignore-system-libart=yes
7+
# if used on command line the config values are not used
8+
-dlt1 = not specialOption('--no-download-t1-files')
9+
-isla = specialOption('--ignore-system-libart')
10+
+dlt1 = False
11+
+isla = True
12+
13+
try:
14+
import configparser
15+
@@ -121,39 +121,6 @@
16+
else:
17+
P.insert(x, d)
18+
19+
-class inc_lib_dirs:
20+
- L = None
21+
- I = None
22+
- def __call__(self):
23+
- if self.L is None:
24+
- L = []
25+
- I = []
26+
- if platform == "cygwin":
27+
- aDir(L, os.path.join("/usr/lib", "python%s" % sys.version[:3], "config"))
28+
- elif platform == "darwin":
29+
- # attempt to make sure we pick freetype2 over other versions
30+
- aDir(I, "/sw/include/freetype2")
31+
- aDir(I, "/sw/lib/freetype2/include")
32+
- # fink installation directories
33+
- aDir(L, "/sw/lib")
34+
- aDir(I, "/sw/include")
35+
- # darwin ports installation directories
36+
- aDir(L, "/opt/local/lib")
37+
- aDir(I, "/opt/local/include")
38+
- aDir(I, "/usr/local/include")
39+
- aDir(L, "/usr/local/lib")
40+
- aDir(I, "/usr/include")
41+
- aDir(L, "/usr/lib")
42+
- aDir(I, "/usr/include/freetype2")
43+
- prefix = sysconfig.get_config_var("prefix")
44+
- if prefix:
45+
- aDir(L, pjoin(prefix, "lib"))
46+
- aDir(I, pjoin(prefix, "include"))
47+
- self.L=L
48+
- self.I=I
49+
- return self.I,self.L
50+
-inc_lib_dirs=inc_lib_dirs()
51+
-
52+
def getVersionFromCCode(fn):
53+
import re
54+
tag = re.search(r'^#define\s+VERSION\s+"([^"]*)"',open(fn,'r').read(),re.M)
55+
@@ -244,11 +211,7 @@
56+
]
57+
58+
def get_fonts(PACKAGE_DIR, reportlab_files):
59+
- import sys, os, os.path, zipfile, io
60+
- if isPy3:
61+
- import urllib.request as ureq
62+
- else:
63+
- import urllib2 as ureq
64+
+ import os, os.path
65+
rl_dir = PACKAGE_DIR['reportlab']
66+
if not [x for x in reportlab_files if not os.path.isfile(pjoin(rl_dir,x))]:
67+
infoline("Standard T1 font curves already downloaded")
68+
@@ -257,6 +220,11 @@
69+
infoline('not downloading T1 font curve files')
70+
return
71+
try:
72+
+ if isPy3:
73+
+ import urllib.request as ureq
74+
+ else:
75+
+ import urllib2 as ureq
76+
+ import zipfile, io
77+
infoline("Downloading standard T1 font curves")
78+
79+
remotehandle = ureq.urlopen("http://www.reportlab.com/ftp/pfbfer-20070710.zip")
80+
@@ -448,7 +416,8 @@
81+
FT_LIB_DIR=[FT_LIB_DIR] if FT_LIB_DIR else []
82+
FT_INC_DIR=config('FREETYPE_PATHS','inc')
83+
FT_INC_DIR=[FT_INC_DIR] if FT_INC_DIR else []
84+
- I,L=inc_lib_dirs()
85+
+ I=["_FT_INC_"]
86+
+ L=["_FT_LIB_"]
87+
ftv = None
88+
for d in I:
89+
if isfile(pjoin(d, "ft2build.h")):

0 commit comments

Comments
 (0)