-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python 2 updated to version 2.7.9 #678
Changes from 3 commits
9a30281
edef626
1206c30
2c7e384
0809593
8483d53
08b797d
2201007
052db55
e566a6e
efd7656
318f744
e3e0abd
fe04e50
ec20c90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
|
||
from pythonforandroid.toolchain import Recipe, shprint, current_directory, info, warning | ||
from os.path import join, exists | ||
from os import chdir | ||
from os import environ | ||
import sh | ||
|
||
|
||
class Hostpython2Recipe(Recipe): | ||
version = '2.7.2' | ||
url = 'http://python.org/ftp/python/{version}/Python-{version}.tar.bz2' | ||
version = '2.7.9' | ||
url = 'http://python.org/ftp/python/{version}/Python-{version}.tgz' # tar.bz2' | ||
name = 'hostpython2' | ||
|
||
conflicts = ['hostpython3'] | ||
|
||
def get_recipe_env(self, arch): | ||
env = super(Hostpython2Recipe, self).get_recipe_env(arch) | ||
env['CFLAGS'] = ' '.join([env['CFLAGS'], '-Wformat']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not necessary at all. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks!!! |
||
return env | ||
|
||
def get_build_container_dir(self, arch=None): | ||
choices = self.check_recipe_choices() | ||
dir_name = '-'.join([self.name] + choices) | ||
|
@@ -24,22 +29,37 @@ def prebuild_arch(self, arch): | |
# Override hostpython Setup? | ||
shprint(sh.cp, join(self.get_recipe_dir(), 'Setup'), | ||
join(self.get_build_dir(), 'Modules', 'Setup')) | ||
# Hack to make it work from user recipes, referenced on python-for-android issues #613 | ||
# recipe_dir = self.get_recipe(self.name, arch.arch).recipe_dir | ||
# shprint(sh.cp, join(recipe_dir, 'Setup'), join(self.get_build_dir(), 'Modules', 'Setup')) | ||
|
||
|
||
def build_arch(self, arch): | ||
|
||
with current_directory(self.get_build_dir()): | ||
if exists('hostpython'): | ||
info('Setting ctx hostpython from previous build...') | ||
self.ctx.hostpython = join(self.get_build_dir(), 'hostpython') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While this is indeed an issue, this is the wrong place to fix it. |
||
self.ctx.hostpgen = join(self.get_build_dir(), 'hostpgen') | ||
else: | ||
info('Must build hostpython...') | ||
self.do_build_arch(arch) | ||
|
||
def do_build_arch(self, arch): | ||
env = dict(environ) | ||
with current_directory(self.get_build_dir()): | ||
if exists('hostpython'): | ||
info('hostpython already exists, skipping build') | ||
self.ctx.hostpython = join(self.get_build_dir(), | ||
'hostpython') | ||
self.ctx.hostpgen = join(self.get_build_dir(), | ||
'hostpgen') | ||
return | ||
|
||
configure = sh.Command('./configure') | ||
|
||
shprint(configure) | ||
shprint(sh.make, '-j5') | ||
shprint(configure, _env=env) | ||
shprint(sh.make, '-j5', _env=env) | ||
|
||
shprint(sh.mv, join('Parser', 'pgen'), 'hostpgen') | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,65 @@ | ||
from pythonforandroid.recipe import Recipe | ||
import sh | ||
from os.path import exists, join | ||
from pythonforandroid.logger import shprint | ||
from pythonforandroid.recipe import Recipe | ||
from pythonforandroid.util import current_directory | ||
from os.path import exists, join | ||
import sh | ||
import glob | ||
|
||
|
||
class LibffiRecipe(Recipe): | ||
name = 'libffi' | ||
version = 'v3.2.1' | ||
url = 'https://github.com/atgreen/libffi/archive/{version}.zip' | ||
name = 'libffi' | ||
version = 'v3.2.1' | ||
url = 'https://github.com/atgreen/libffi/archive/{version}.zip' | ||
|
||
patches = ['remove-version-info.patch'] | ||
|
||
patches = ['remove-version-info.patch'] | ||
def get_host(self, arch): | ||
with current_directory(self.get_build_dir(arch.arch)): | ||
host = None | ||
with open('Makefile') as f: | ||
for line in f: | ||
if line.startswith('host = '): | ||
host = line.strip()[7:] | ||
break | ||
|
||
def get_host(self, arch): | ||
with current_directory(self.get_build_dir(arch.arch)): | ||
host = None | ||
with open('Makefile') as f: | ||
for line in f: | ||
if line.startswith('host = '): | ||
host = line.strip()[7:] | ||
break | ||
if not host or not exists(host): | ||
raise RuntimeError('failed to find build output! ({})' | ||
.format(host)) | ||
|
||
if not host or not exists(host): | ||
raise RuntimeError('failed to find build output! ({})' | ||
.format(host)) | ||
|
||
return host | ||
return host | ||
|
||
def should_build(self, arch): | ||
# return not bool(glob.glob(join(self.ctx.get_libs_dir(arch.arch), | ||
# 'libffi.so*'))) | ||
return not exists(join(self.ctx.get_libs_dir(arch.arch), 'libffi.so')) | ||
# return not exists(join(self.ctx.get_python_install_dir(), 'lib', | ||
# 'libffi.so')) | ||
def get_lib_dir(self, arch): | ||
return join(self.get_build_dir(arch.arch), self.get_host(arch), '.libs') | ||
|
||
def build_arch(self, arch): | ||
env = self.get_recipe_env(arch) | ||
with current_directory(self.get_build_dir(arch.arch)): | ||
if not exists('configure'): | ||
shprint(sh.Command('./autogen.sh'), _env=env) | ||
shprint(sh.Command('./configure'), '--host=' + arch.toolchain_prefix, | ||
'--prefix=' + self.ctx.get_python_install_dir(), | ||
'--enable-shared', _env=env) | ||
shprint(sh.make, '-j5', 'libffi.la', _env=env) | ||
def should_build(self, arch): | ||
return not self.has_libs(arch, 'libffi.so') | ||
|
||
def build_arch(self, arch): | ||
env = self.get_recipe_env(arch) | ||
with current_directory(self.get_build_dir(arch.arch)): | ||
if not exists('configure'): | ||
shprint(sh.Command('./autogen.sh'), _env=env) | ||
shprint(sh.Command('./configure'), '--host=' + arch.toolchain_prefix, | ||
'--prefix=' + self.ctx.get_python_install_dir(), | ||
'--enable-shared', _env=env) | ||
shprint(sh.make, '-j5', 'libffi.la', _env=env) | ||
|
||
# dlname = None | ||
# with open(join(host, 'libffi.la')) as f: | ||
# for line in f: | ||
# if line.startswith('dlname='): | ||
# dlname = line.strip()[8:-1] | ||
# break | ||
# | ||
# if not dlname or not exists(join(host, '.libs', dlname)): | ||
# raise RuntimeError('failed to locate shared object! ({})' | ||
# .format(dlname)) | ||
# dlname = None | ||
# with open(join(host, 'libffi.la')) as f: | ||
# for line in f: | ||
# if line.startswith('dlname='): | ||
# dlname = line.strip()[8:-1] | ||
# break | ||
# | ||
# if not dlname or not exists(join(host, '.libs', dlname)): | ||
# raise RuntimeError('failed to locate shared object! ({})' | ||
# .format(dlname)) | ||
|
||
# shprint(sh.sed, '-i', 's/^dlname=.*$/dlname=\'libffi.so\'/', join(host, 'libffi.la')) | ||
# shprint(sh.sed, '-i', 's/^dlname=.*$/dlname=\'libffi.so\'/', join(host, 'libffi.la')) | ||
|
||
shprint(sh.cp, '-t', self.ctx.get_libs_dir(arch.arch), | ||
join(self.get_host(arch), '.libs', 'libffi.so')) #, | ||
# join(host, 'libffi.la')) | ||
self.install_libs(arch, join(self.get_host(arch), '.libs', 'libffi.so')) | ||
|
||
def get_include_dirs(self, arch): | ||
return [join(self.get_build_dir(arch.arch), self.get_host(arch), 'include')] | ||
def get_include_dirs(self, arch): | ||
return [join(self.get_build_dir(arch.arch), self.get_host(arch), 'include')] | ||
|
||
|
||
recipe = LibffiRecipe() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
|
||
class OpenSSLRecipe(Recipe): | ||
version = '1.0.2f' | ||
version = '1.0.2g' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change has already been made in master, and required a change to the patch as well - but you haven't modified the patch. This can't actually be working as the patch will fail to apply to 1.0.2g and therefore the build will fail. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are totally right, I forgot to update the patch, now the changes has been made. Many thanks to mention it !!! |
||
url = 'https://www.openssl.org/source/openssl-{version}.tar.gz' | ||
|
||
def should_build(self, arch): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this changed to
.tgz
? Are the bzip2 archives not distributed anymore? bzip2 should be preferred as it is a smaller download at the expense of slower extraction - but people are far more likely to have download caps than execution caps.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the package no longer exist in *.bz2 compression for this version of python, only exist in *.tgz format...