Skip to content

Commit d4c33bc

Browse files
authored
Merge pull request kivy#1173 from replabrobin/master
add recipes for pyrxp & reportlab
2 parents 05bfc63 + 6fc4fb9 commit d4c33bc

File tree

5 files changed

+189
-0
lines changed

5 files changed

+189
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from pythonforandroid.toolchain import PythonRecipe
2+
class PreppyRecipe(PythonRecipe):
3+
version = '27b7085'
4+
url = 'https://bitbucket.org/rptlab/preppy/get/{version}.tar.gz'
5+
depends = []
6+
patches = ['fix-setup.patch']
7+
call_hostpython_via_targetpython = False
8+
9+
recipe = PreppyRecipe()
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
--- a/setup.py 2017-11-20 13:53:42.000000000 +0000
2+
+++ b/setup.py 2017-11-20 14:00:44.862203526 +0000
3+
@@ -15,35 +15,6 @@
4+
5+
import preppy
6+
version = preppy.VERSION
7+
- scriptsPath=os.path.join(pkgDir,'build','scripts')
8+
-
9+
- def makeScript(modName):
10+
- try:
11+
- bat=sys.platform in ('win32','amd64')
12+
- scriptPath=os.path.join(scriptsPath,modName+(bat and '.bat' or ''))
13+
- exePath=sys.executable
14+
- f = open(scriptPath,'w')
15+
- try:
16+
- if bat:
17+
- text = '@echo off\nrem startup script for %s-%s\n"%s" -m "%s" %%*\n' % (modName,version,exePath,modName)
18+
- else:
19+
- text = '#!/bin/sh\n#startup script for %s-%s\nexec "%s" -m "%s" $*\n' % (modName,version,exePath,modName)
20+
- f.write(text)
21+
- finally:
22+
- f.close()
23+
- except:
24+
- print('script for %s not created or erroneous' % modName)
25+
- import traceback
26+
- traceback.print_exc(file=sys.stdout)
27+
- return None
28+
- print('Created "%s"' % scriptPath)
29+
- return scriptPath
30+
-
31+
- scripts = []
32+
- if not os.path.isdir(scriptsPath): os.makedirs(scriptsPath)
33+
- scripts.extend(filter(None,[
34+
- makeScript('preppy'),
35+
- ]))
36+
37+
setup(name='preppy',
38+
version=version,
39+
@@ -52,5 +23,4 @@
40+
author_email='andy@reportlab.com',
41+
url='http://bitbucket.org/rptlab/preppy',
42+
py_modules=['preppy'],
43+
- scripts=scripts,
44+
)
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: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
shprint(sh.touch, os.path.join(recipe_dir, '.patched'))
16+
ft = self.get_recipe('freetype',self.ctx)
17+
ft_dir = ft.get_build_dir(arch.arch)
18+
ft_lib_dir = os.environ.get('_FT_LIB_',os.path.join(ft_dir,'objs','.libs'))
19+
ft_inc_dir = os.environ.get('_FT_INC_',os.path.join(ft_dir,'include'))
20+
tmp_dir = os.path.normpath(os.path.join(recipe_dir,"..","..","tmp"))
21+
info('reportlab recipe: recipe_dir={}'.format(recipe_dir))
22+
info('reportlab recipe: tmp_dir={}'.format(tmp_dir))
23+
info('reportlab recipe: ft_dir={}'.format(ft_dir))
24+
info('reportlab recipe: ft_lib_dir={}'.format(ft_lib_dir))
25+
info('reportlab recipe: ft_inc_dir={}'.format(ft_inc_dir))
26+
with current_directory(recipe_dir):
27+
sh.ls('-lathr')
28+
ensure_dir(tmp_dir)
29+
pfbfile = os.path.join(tmp_dir,"pfbfer-20070710.zip")
30+
if not os.path.isfile(pfbfile):
31+
sh.wget("http://www.reportlab.com/ftp/pfbfer-20070710.zip", "-O", pfbfile)
32+
sh.unzip("-u", "-d", os.path.join(recipe_dir, "src", "reportlab", "fonts"), pfbfile)
33+
if os.path.isfile("setup.py"):
34+
with open('setup.py','rb') as f:
35+
text = f.read().replace('_FT_LIB_',ft_lib_dir).replace('_FT_INC_',ft_inc_dir)
36+
with open('setup.py','wb') as f:
37+
f.write(text)
38+
39+
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)