Skip to content
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

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions pythonforandroid/recipes/hostpython2/Setup
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ PYTHONPATH=$(COREPYTHONPATH)
# various reasons; therefore they are listed here instead of in the
# normal order.

# This only contains the minimal set of modules required to run the
# This only contains the minimal set of modules required to run the
# setup.py script in the root of the Python source tree.

posix posixmodule.c # posix (UNIX) system calls
Expand All @@ -118,6 +118,7 @@ pwd pwdmodule.c # this is needed to find out the user's home dir
# if $HOME is not set
_sre _sre.c # Fredrik Lundh's new regular expressions
_codecs _codecsmodule.c # access to the builtin codecs and codec registry
_weakref _weakref.c # weak references

# The zipimport module is always imported at startup. Having it as a
# builtin module avoids some bootstrapping problems and reduces overhead.
Expand All @@ -126,9 +127,9 @@ zipimport zipimport.c
# The rest of the modules listed in this file are all commented out by
# default. Usually they can be detected and built as dynamically
# loaded modules by the new setup.py script added in Python 2.1. If
# you're on a platform that doesn't support dynamic loading, want to
# compile modules statically into the Python binary, or need to
# specify some odd set of compiler switches, you can uncomment the
# you're on a platform that doesn't support dynamic loading, want to
# compile modules statically into the Python binary, or need to
# specify some odd set of compiler switches, you can uncomment the
# appropriate lines below.

# ======================================================================
Expand Down Expand Up @@ -168,16 +169,16 @@ GLHACK=-Dclear=__GLclear
# Modules that should always be present (non UNIX dependent):

array arraymodule.c # array objects
cmath cmathmodule.c # -lm # complex math library functions
math mathmodule.c # -lm # math library functions, e.g. sin()
cmath cmathmodule.c _math.c # -lm # complex math library functions
math mathmodule.c # _math.c # -lm # math library functions, e.g. sin()
_struct _struct.c # binary structure packing/unpacking
time timemodule.c # -lm # time operations and variables
operator operator.c # operator.add() and similar goodies
_weakref _weakref.c # basic weak reference support
#_testcapi _testcapimodule.c # Python C API test module
_random _randommodule.c # Random number generator
_collections _collectionsmodule.c # Container types
itertools itertoolsmodule.c # Functions creating iterators for efficient looping
#_heapq _heapqmodule.c # Heapq type
itertools itertoolsmodule.c # Functions creating iterators for efficient looping
strop stropmodule.c # String manipulations
_functools _functoolsmodule.c # Tools for working with functions and callable objects
_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c # elementtree accelerator
Expand All @@ -190,13 +191,16 @@ _bisect _bisectmodule.c # Bisection algorithms
# access to ISO C locale support
#_locale _localemodule.c # -lintl

# Standard I/O baseline
#_io -I$(srcdir)/Modules/_io _io/bufferedio.c _io/bytesio.c _io/fileio.c _io/iobase.c _io/_iomodule.c _io/stringio.c _io/textio.c


# Modules with some UNIX dependencies -- on by default:
# (If you have a really backward UNIX, select and socket may not be
# supported...)

fcntl fcntlmodule.c # fcntl(2) and ioctl(2)
#spwd spwdmodule.c # spwd(3)
#spwd spwdmodule.c # spwd(3)
#grp grpmodule.c # grp(3)
select selectmodule.c # select(2); not on ancient System V

Expand Down Expand Up @@ -299,7 +303,7 @@ _sha512 sha512module.c
#sunaudiodev sunaudiodev.c


# A Linux specific module -- off by default; this may also work on
# A Linux specific module -- off by default; this may also work on
# some *BSDs.

#linuxaudiodev linuxaudiodev.c
Expand Down Expand Up @@ -365,7 +369,7 @@ _sha512 sha512module.c

#_curses _cursesmodule.c -lcurses -ltermcap
# Wrapper for the panel library that's part of ncurses and SYSV curses.
#_curses_panel _curses_panel.c -lpanel -lncurses
#_curses_panel _curses_panel.c -lpanel -lncurses


# Generic (SunOS / SVR4) dynamic loading module.
Expand Down
32 changes: 26 additions & 6 deletions pythonforandroid/recipes/hostpython2/__init__.py
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'
Copy link
Contributor

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.

Copy link
Member Author

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...

name = 'hostpython2'

conflicts = ['hostpython3']

def get_recipe_env(self, arch):
env = super(Hostpython2Recipe, self).get_recipe_env(arch)
env['CFLAGS'] = ' '.join([env['CFLAGS'], '-Wformat'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessary at all.

Copy link
Member Author

Choose a reason for hiding this comment

The 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)
Expand All @@ -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')
Copy link
Contributor

Choose a reason for hiding this comment

The 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')

Expand Down
99 changes: 47 additions & 52 deletions pythonforandroid/recipes/libffi/__init__.py
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()
2 changes: 1 addition & 1 deletion pythonforandroid/recipes/openssl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class OpenSSLRecipe(Recipe):
version = '1.0.2f'
version = '1.0.2g'
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patch needed to be changed from e->f #615
f->g was ok #675

Copy link
Member Author

Choose a reason for hiding this comment

The 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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import sh
import glob


class PygameJNIComponentsRecipe(BootstrapNDKRecipe):
version = 'master'
url = 'https://github.com/kivy/p4a-pygame-bootstrap-components/archive/{version}.zip'
Expand All @@ -22,6 +23,12 @@ def prebuild_arch(self, arch):
shprint(sh.mv, dirn, './')
info('Unpacking was successful, deleting original container dir')
shprint(sh.rm, '-rf', self.get_build_dir(arch))

def build_arch(self, arch):
# TO FORCE BUILD SQLITE3 BEFORE PYTHON
env = self.get_recipe_env(arch)
with current_directory(self.get_jni_dir()):
shprint(sh.ndk_build, "V=1", "sqlite3", _env=env)


recipe = PygameJNIComponentsRecipe()
Loading