mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
android: adapt to python3.
android: Install p4a using pip Add 'set -e' to sh scripts, they must stop upon any error README.md: kivy does not specifically require python2 android: Overhaul initialization scripts android: Simplify apk build scripts by using the 'common' file Merge the scripts cardconv and cardsetsgiftobmp android: Fix startup script shebang to python3 android: Simplify mkkeystore and ignore the keystore file android: Fix up debian prerequisites The package cython (as opposed to cython3) even caused me to produce an apk that did not start (TypeError: must be str, not bytes). Android SDK requires java8; install and set as the default. The build processes complained about lld and libtinfo5; added in. mercurial (or hg) is seemingly unused. The pip pcakges were needed by android/initsdk.py which is gone. android: Ensure that the html files are built
This commit is contained in:
parent
15365f6267
commit
fdebf13171
27 changed files with 197 additions and 564 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -23,3 +23,7 @@ PySolFC-Cardsets--Minimal-2.0/
|
|||
PySolFC-Cardsets--Minimal-2.0.*
|
||||
PySolFC-Cardsets-2.0/
|
||||
PySolFC-Cardsets-2.0.*
|
||||
|
||||
android/bin/keystore
|
||||
android/*.zip
|
||||
android/*.apk
|
||||
|
|
|
@ -20,7 +20,7 @@ graft data/themes
|
|||
recursive-exclude data/themes *.py
|
||||
include scripts/build.bat scripts/create_iss.py scripts/mahjongg_utils.py
|
||||
include scripts/all_games.py scripts/cardset_viewer.py
|
||||
include scripts/cardconv scripts/cardsetsgiftobmp
|
||||
include scripts/cardconv
|
||||
include scripts/gen_individual_importing_tests.py
|
||||
include tests/individually-importing/PLACEHOLDER
|
||||
recursive-include tests/lib *.pm *.py
|
||||
|
|
|
@ -70,7 +70,7 @@ Cardsets:
|
|||
|
||||
Cardsets should be installed in ${HOME}/.PySolFC/cardsets/. On an
|
||||
android device this is equivalent to /sdcard/.PySolFC/cardsets/.
|
||||
Cardsets must use the bmp image format. Use scripts/cardsetsgiftobmp
|
||||
Cardsets must use the bmp image format. Use scripts/cardconv
|
||||
(on a linux system) to convert them, before copying to the device.
|
||||
|
||||
Possible known build issues:
|
||||
|
|
|
@ -39,7 +39,7 @@ kivy version.
|
|||
|
||||
Additional cardsets are available from the SourceForge
|
||||
project. To use them with kivy, they need to be converted to
|
||||
the BMP format. A shell script, 'cardsetsgiftobmp' , has been added
|
||||
the BMP format. A shell script, 'cardconv' , has been added
|
||||
to the scripts directory (it requires Bash and ImageMagick).
|
||||
|
||||
For all GIF images in the directories data/images and data/tiles ,
|
||||
|
|
|
@ -144,7 +144,6 @@ mkdir -p "$PKGDIR"
|
|||
|
||||
## Alternate toolkit.
|
||||
|
||||
- Python2 (2.7 or later)
|
||||
- Kivy (10.0 or later)
|
||||
|
||||
- Features:
|
||||
|
@ -154,7 +153,7 @@ mkdir -p "$PKGDIR"
|
|||
- Running from source without installation:
|
||||
|
||||
```
|
||||
python2 pysol.py --kivy
|
||||
python pysol.py --kivy
|
||||
```
|
||||
|
||||
### Configuring Freecell Solver
|
||||
|
|
|
@ -10,9 +10,6 @@ root$ ./apt-install.sh
|
|||
|
||||
root$ exit
|
||||
|
||||
user$ ./pip-install.sh
|
||||
- .....some output.
|
||||
|
||||
Now all required packages are installed to proceed with the
|
||||
android build.
|
||||
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
#!/bin/bash
|
||||
# als root ausführen!
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
apt-get install -y mercurial git default-jdk
|
||||
apt-get install -y cython cython3
|
||||
apt-get install -y python3-pip
|
||||
apt-get install -y python3-yaml
|
||||
apt-get install -y virtualenv
|
||||
apt-get install -y pkg-config
|
||||
apt-get install -y automake autoconf libtool
|
||||
apt-get install -y zlib1g-dev
|
||||
apt-get install -y libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev
|
||||
# install as root
|
||||
|
||||
apt-get install -y \
|
||||
git \
|
||||
openjdk-8-jdk \
|
||||
cython3 \
|
||||
python3-pip \
|
||||
python3-yaml \
|
||||
virtualenv \
|
||||
pkg-config \
|
||||
automake autoconf libtool \
|
||||
zlib1g-dev \
|
||||
libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \
|
||||
libtinfo5 \
|
||||
lld
|
||||
|
||||
update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# als user installieren !
|
||||
|
||||
python3 -m pip install --user pyasn1
|
||||
python3 -m pip install --user pyasn1_modules
|
||||
python3 -m pip install --user requests
|
||||
python3 -m pip install --user clint
|
26
android/initsdk
Executable file
26
android/initsdk
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
set -eux
|
||||
# This script mimics the instructions laid out in the p4a documentation:
|
||||
# https://python-for-android.readthedocs.io/en/latest/quickstart/
|
||||
|
||||
. mkp4a.common
|
||||
|
||||
if [[ -d $sdkdir && -d $ndkdir ]]; then
|
||||
echo "Skipping SDK and NDK installation: SDK and NDK directories already exist."
|
||||
exit
|
||||
fi
|
||||
|
||||
urlbase=https://dl.google.com/android/repository/
|
||||
tools_zip=sdk-tools-linux-4333796.zip
|
||||
ndk_zip=android-ndk-r17c-linux-x86_64.zip
|
||||
|
||||
mkdir -p $sdkdir $ndkdir
|
||||
|
||||
[ -a $ndk_zip ] || wget $urlbase/$ndk_zip
|
||||
unzip -d $(dirname $ndkdir) $ndk_zip
|
||||
|
||||
[ -a $tools_zip ] || wget $urlbase/$tools_zip
|
||||
unzip -d $sdkdir $tools_zip
|
||||
|
||||
$sdkdir/tools/bin/sdkmanager 'platforms;android-27'
|
||||
$sdkdir/tools/bin/sdkmanager 'build-tools;29.0.1'
|
|
@ -1,243 +0,0 @@
|
|||
#! /usr/bin/env python3
|
||||
# -*- coding: iso-8859-1 -*-
|
||||
|
||||
import glob
|
||||
import hashlib
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from zipfile import ZipFile, ZipInfo
|
||||
|
||||
from clint.textui import progress
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
cachefiles = [
|
||||
('https://dl.google.com/android/repository/platform-tools-latest-linux.zip',
|
||||
'',
|
||||
'platform-tools'),
|
||||
('https://dl.google.com/android/repository/tools_r25.2.5-linux.zip',
|
||||
'577516819c8b5fae680f049d39014ff1ba4af870b687cab10595783e6f22d33e',
|
||||
'tools'),
|
||||
('https://dl.google.com/android/repository/android-19_r04.zip',
|
||||
'5efc3a3a682c1d49128daddb6716c433edf16e63349f32959b6207524ac04039',
|
||||
'platform'),
|
||||
('https://dl.google.com/android/repository/build-tools_r26-linux.zip',
|
||||
'7422682f92fb471d4aad4c053c9982a9a623377f9d5e4de7a73cd44ebf2f3c61',
|
||||
'build-tools'),
|
||||
('https://dl.google.com/'
|
||||
'android/repository/android-ndk-r12b-linux-x86_64.zip',
|
||||
'eafae2d614e5475a3bcfd7c5f201db5b963cc1290ee3e8ae791ff0c66757781e',
|
||||
'ndk'),
|
||||
]
|
||||
|
||||
# https://stackoverflow.com/questions/39296101:
|
||||
|
||||
|
||||
class MyZipFile(ZipFile):
|
||||
|
||||
def extract(self, member, path=None, pwd=None):
|
||||
if not isinstance(member, ZipInfo):
|
||||
member = self.getinfo(member)
|
||||
|
||||
if path is None:
|
||||
path = os.getcwd()
|
||||
|
||||
ret_val = self._extract_member(member, path, pwd)
|
||||
attr = member.external_attr >> 16
|
||||
os.chmod(ret_val, attr)
|
||||
return ret_val
|
||||
|
||||
# Reused from fdroidserver:
|
||||
|
||||
|
||||
def sha256_for_file(path):
|
||||
with open(path, 'rb') as f:
|
||||
s = hashlib.sha256()
|
||||
while True:
|
||||
data = f.read(4096)
|
||||
if not data:
|
||||
break
|
||||
s.update(data)
|
||||
return s.hexdigest()
|
||||
|
||||
# Adapted from fdroidserver:
|
||||
|
||||
|
||||
def update_cache(cachedir, cachefiles):
|
||||
for srcurl, shasum, typ in cachefiles:
|
||||
filename = os.path.basename(srcurl)
|
||||
local_filename = os.path.join(cachedir, filename)
|
||||
|
||||
if os.path.exists(local_filename):
|
||||
local_length = os.path.getsize(local_filename)
|
||||
else:
|
||||
|
||||
local_length = -1
|
||||
|
||||
if (typ == 'ndk') and (ndkloc is not None):
|
||||
continue
|
||||
elif (typ != 'tools') and (sdkloc is not None):
|
||||
continue
|
||||
|
||||
resume_header = {}
|
||||
download = True
|
||||
|
||||
try:
|
||||
r = requests.head(srcurl, allow_redirects=True, timeout=60)
|
||||
if r.status_code == 200:
|
||||
content_length = int(r.headers.get('content-length'))
|
||||
else:
|
||||
content_length = local_length # skip the download
|
||||
except requests.exceptions.RequestException as e:
|
||||
content_length = local_length # skip the download
|
||||
logger.warn('%s', e)
|
||||
|
||||
if local_length == content_length:
|
||||
download = False
|
||||
elif local_length > content_length:
|
||||
logger.info('deleting corrupt file from cache: %s',
|
||||
local_filename)
|
||||
os.remove(local_filename)
|
||||
logger.info("Downloading %s to cache", filename)
|
||||
elif local_length > -1 and local_length < content_length:
|
||||
logger.info("Resuming download of %s", local_filename)
|
||||
resume_header = {
|
||||
'Range': 'bytes=%d-%d' % (local_length, content_length)}
|
||||
else:
|
||||
logger.info("Downloading %s to cache", filename)
|
||||
|
||||
if download:
|
||||
r = requests.get(srcurl, headers=resume_header,
|
||||
stream=True, verify=False, allow_redirects=True)
|
||||
content_length = int(r.headers.get('content-length'))
|
||||
with open(local_filename, 'ab') as f:
|
||||
for chunk in progress.bar(
|
||||
r.iter_content(chunk_size=65536),
|
||||
expected_size=(content_length / 65536) + 1):
|
||||
if chunk: # filter out keep-alive new chunks
|
||||
f.write(chunk)
|
||||
if not shasum == '':
|
||||
v = sha256_for_file(local_filename)
|
||||
if v == shasum:
|
||||
logger.info("Shasum verified for %s", local_filename)
|
||||
else:
|
||||
logger.critical(
|
||||
"Invalid shasum of '%s' detected for %s", v, local_filename)
|
||||
os.remove(local_filename)
|
||||
sys.exit(1)
|
||||
|
||||
# Build the sdk from zips.
|
||||
|
||||
|
||||
def build_sdk(sdkdir, cachedir, cachfiles):
|
||||
for srcurl, shasum, typ in cachefiles:
|
||||
filename = os.path.basename(srcurl)
|
||||
local_filename = os.path.join(cachedir, filename)
|
||||
|
||||
if typ == 'tools':
|
||||
if os.path.exists(local_filename):
|
||||
print('Extract: %s' % local_filename)
|
||||
zf = MyZipFile(local_filename)
|
||||
zf.extractall(sdkdir)
|
||||
elif typ == 'platform-tools':
|
||||
if (sdkloc is None) and (os.path.exists(local_filename)):
|
||||
print('Extract: %s' % local_filename)
|
||||
zf = MyZipFile(local_filename)
|
||||
zf.extractall(sdkdir)
|
||||
else:
|
||||
print('Link to: %s' % sdkloc)
|
||||
os.symlink(sdkloc + '/platform-tools',
|
||||
sdkdir + '/platform-tools')
|
||||
elif typ == 'platform':
|
||||
if (sdkloc is None) and (os.path.exists(local_filename)):
|
||||
print('Extract: %s' % local_filename)
|
||||
zf = MyZipFile(local_filename)
|
||||
zf.extractall(sdkdir + '/platforms')
|
||||
else:
|
||||
print('Link to: %s' % sdkloc)
|
||||
os.symlink(sdkloc + '/platforms', sdkdir + '/platforms')
|
||||
elif typ == 'build-tools':
|
||||
if (sdkloc is None) and (os.path.exists(local_filename)):
|
||||
print('Extract: %s' % local_filename)
|
||||
zf = MyZipFile(local_filename)
|
||||
zf.extractall(sdkdir + '/build-tools')
|
||||
else:
|
||||
print('Link to: %s' % sdkloc)
|
||||
os.symlink(sdkloc + '/build-tools', sdkdir + '/build-tools')
|
||||
elif typ == 'ndk':
|
||||
if ndkloc is None:
|
||||
print('Extract: %s' % local_filename)
|
||||
zf = MyZipFile(local_filename)
|
||||
zf.extractall(sdkdir)
|
||||
lst = glob.glob(sdkdir + '/*-ndk-*')
|
||||
print(lst)
|
||||
os.rename(lst[0], sdkdir + '/ndk-bundle')
|
||||
else:
|
||||
print('Link to: %s' % ndkloc)
|
||||
os.symlink(ndkloc, sdkdir + '/ndk-bundle')
|
||||
|
||||
|
||||
logger = logging.getLogger('prepare-fdroid-build')
|
||||
logging.basicConfig(format='%(message)s', level=logging.INFO)
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
# command line arguments
|
||||
|
||||
sdkloc = None
|
||||
ndkloc = None
|
||||
if len(sys.argv) > 1:
|
||||
sdkloc = sys.argv[1]
|
||||
if (len(sdkloc) > 0) and (sdkloc[-1] == '/'):
|
||||
sdkloc = sdkloc[:-1]
|
||||
if not os.path.isdir(sdkloc):
|
||||
sdkloc = None
|
||||
|
||||
if len(sys.argv) > 2:
|
||||
ndkloc = sys.argv[2]
|
||||
if (len(ndkloc) > 0) and (ndkloc[-1] == '/'):
|
||||
ndkloc = ndkloc[:-1]
|
||||
if not os.path.isdir(ndkloc):
|
||||
ndkloc = None
|
||||
|
||||
fdroidmode = None
|
||||
if len(sys.argv) > 3:
|
||||
fdroidmode = sys.argv[3]
|
||||
if (len(fdroidmode) > 0):
|
||||
fdroidmode = '1'
|
||||
|
||||
if sdkloc == "":
|
||||
sdkloc = None
|
||||
if ndkloc == "":
|
||||
ndkloc = None
|
||||
|
||||
logger.info('sdkloc = %s' % sdkloc)
|
||||
logger.info('ndkloc = %s' % ndkloc)
|
||||
|
||||
# sdkloc and ndkloc already set by the user and fdroidmode:
|
||||
# nothing to do.
|
||||
|
||||
if (sdkloc is not None) and (ndkloc is not None) and (fdroidmode is not None):
|
||||
sys.exit(0)
|
||||
|
||||
# cache dir (using the same as in fdroidserver/buildserver)
|
||||
cachedir = os.path.join(os.getenv('HOME'), '.cache', 'fdroidserver')
|
||||
logger.info('cachedir name is: %s', cachedir)
|
||||
|
||||
if not os.path.exists(cachedir):
|
||||
os.makedirs(cachedir, 0o755)
|
||||
logger.info('created cachedir %s', cachedir)
|
||||
|
||||
# sdkdir location
|
||||
sdkdir = os.path.join(os.getenv('HOME'), '.cache', 'sdk-for-p4a')
|
||||
logger.info('sdkdir name is: %s', sdkdir)
|
||||
|
||||
if not os.path.exists(sdkdir):
|
||||
os.makedirs(sdkdir, 0o755)
|
||||
logger.debug('created sdkdir %s', sdkdir)
|
||||
|
||||
update_cache(cachedir, cachefiles)
|
||||
build_sdk(sdkdir, cachedir, cachefiles)
|
||||
else:
|
||||
logger.info('sdkdir %s already exists', sdkdir)
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python2.7
|
||||
#!/usr/bin/env python3
|
||||
# ---------------------------------------------------------------------------
|
||||
#
|
||||
# PySol -- a Python Solitaire game
|
||||
|
|
|
@ -1,46 +1,27 @@
|
|||
#!/bin/bash
|
||||
set -eux
|
||||
|
||||
. mkp4a.common
|
||||
|
||||
echo '### prepare cardsets'
|
||||
|
||||
if [ ! -f ./PySolFC-Cardsets-2.0.tar.bz2 ]
|
||||
then
|
||||
echo '### downloading cardets'
|
||||
# wget http://downloads.sourceforge.net/pysolfc/PySolFC-Cardsets-2.0.tar.bz2
|
||||
wget https://netix.dl.sourceforge.net/project/pysolfc/PySolFC-Cardsets/PySolFC-Cardsets-2.0/PySolFC-Cardsets-2.0.tar.bz2
|
||||
if [ ! -f ${cardsets_file} ]; then
|
||||
echo '### downloading cardsets'
|
||||
wget https://netix.dl.sourceforge.net/project/pysolfc/PySolFC-Cardsets/minimal/${cardsets_file}
|
||||
fi
|
||||
|
||||
if [ -f ./PySolFC-Cardsets-2.0.tar.bz2 ]
|
||||
then
|
||||
if [ ! -d ./PySolFC-Cardsets-2.0 ]
|
||||
then
|
||||
echo '### extracting selected cardets'
|
||||
tar -xjvf PySolFC-Cardsets-2.0.tar.bz2 \
|
||||
PySolFC-Cardsets-2.0/cardset-crystal-mahjongg \
|
||||
PySolFC-Cardsets-2.0/cardset-dashavatara-ganjifa \
|
||||
PySolFC-Cardsets-2.0/cardset-dondorf \
|
||||
PySolFC-Cardsets-2.0/cardset-hexadeck \
|
||||
PySolFC-Cardsets-2.0/cardset-kintengu \
|
||||
PySolFC-Cardsets-2.0/cardset-matrix \
|
||||
PySolFC-Cardsets-2.0/cardset-mughal-ganjifa \
|
||||
PySolFC-Cardsets-2.0/cardset-oxymoron \
|
||||
PySolFC-Cardsets-2.0/cardset-standard \
|
||||
PySolFC-Cardsets-2.0/cardset-vienna-2k \
|
||||
PySolFC-Cardsets-2.0/cardset-greywyvern
|
||||
if [ ! -d ${cardsets_dir} ]; then
|
||||
echo '### extracting cardsets'
|
||||
tar -xf ${cardsets_file}
|
||||
fi
|
||||
|
||||
if [ -d ./PySolFC-Cardsets-2.0 ]
|
||||
then
|
||||
echo '### processing cardets'
|
||||
cd PySolFC-Cardsets-2.0
|
||||
../../scripts/cardsetsgiftobmp
|
||||
for i in cardset-*-bmp
|
||||
do
|
||||
echo '### processing cardsets'
|
||||
(
|
||||
cd ${cardsets_dir}
|
||||
../../scripts/cardconv
|
||||
for i in cardset-*-bmp; do
|
||||
rm -rf `basename $i -bmp`
|
||||
done
|
||||
cd ..
|
||||
fi
|
||||
else
|
||||
echo '### error downloading cardsets'
|
||||
fi
|
||||
)
|
||||
|
||||
echo '### end cardsets'
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
#!/bin/bash
|
||||
set -eux
|
||||
|
||||
# memo:
|
||||
# keytool -genkey -v -keystore my-release-keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 12000
|
||||
|
||||
if [ ! -d bin ]
|
||||
then
|
||||
echo "mkdir bin"
|
||||
mkdir bin
|
||||
fi
|
||||
mkdir -p bin
|
||||
|
||||
if [ -f ./bin/keystore ]
|
||||
then
|
||||
if [ -f ./bin/keystore ]; then
|
||||
echo "keystore is already defined"
|
||||
else
|
||||
keytool -genkey -v -keystore ./bin/keystore -alias python -keyalg RSA -keysize 2048 -validity 12000
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
set -eux
|
||||
|
||||
rm -rf tmp
|
||||
python3 -m pythonforandroid.toolchain clean_dists
|
||||
python3 -m pythonforandroid.toolchain clean_builds
|
||||
rm -f *.apk
|
||||
rm -rf PySolFC-Cardsets-2.0
|
||||
|
||||
rm -rf PySolFC-Cardsets--Minimal-2.0.1
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
rm -rf tmp
|
||||
rm -f *.apk
|
||||
|
|
28
android/mkp4a.common
Normal file
28
android/mkp4a.common
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Common constants for various scripts in this directory.
|
||||
|
||||
version=$(PYTHONPATH=.. python3 -c \
|
||||
'from pysollib.settings import VERSION; print(VERSION)')
|
||||
|
||||
tmpdir=${HOME}/.cache/tmp-for-p4a/pysolfc/src
|
||||
|
||||
cardsets_dir='PySolFC-Cardsets--Minimal-2.0.1'
|
||||
cardsets_file="${cardsets_dir}.tar.xz"
|
||||
|
||||
sdkdir="${HOME}/.cache/sdk-for-p4a/sdk"
|
||||
ndkdir="${HOME}/.cache/sdk-for-p4a/android-ndk-r17c"
|
||||
|
||||
p4a_options="\
|
||||
--sdk-dir ${sdkdir} \
|
||||
--ndk-dir ${ndkdir} \
|
||||
--dist-name pysolfc \
|
||||
--name PySolFC \
|
||||
--package org.lufebe16.pysolfc \
|
||||
--version ${version} \
|
||||
--bootstrap sdl2 \
|
||||
--requirements python3,attrs,configobj,kivy,pysol-cards,random2,six \
|
||||
--private ${tmpdir} \
|
||||
--orientation sensor \
|
||||
--icon ${tmpdir}/data/images/icons/48x48/pysol.png \
|
||||
--presplash ${tmpdir}/data/images/icons/1024x1024/pysol.png \
|
||||
--copy-libs \
|
||||
--color always"
|
|
@ -1,32 +1,11 @@
|
|||
#!/bin/bash
|
||||
set -eux
|
||||
|
||||
package='org.lufebe16.pysolfc'
|
||||
version=`./version.py`
|
||||
name='PySolFC'
|
||||
tmpdir=${HOME}/.cache/tmp-for-p4a/pysolfc/src
|
||||
. mkp4a.common
|
||||
|
||||
if [ "$1" ]
|
||||
then
|
||||
package=${package}.dbg
|
||||
name=${name}dbg
|
||||
fi
|
||||
new_options=${p4a_options}
|
||||
new_options=${new_options/PySolFC/PySolFCdbg}
|
||||
new_options=${new_options/org.lubefe16.pysolfc/org.lubefe16.pysolfc.dbg}
|
||||
|
||||
python3 -m pythonforandroid.toolchain apk \
|
||||
--sdk-dir ${HOME}/.cache/sdk-for-p4a \
|
||||
--ndk-dir ${HOME}/.cache/sdk-for-p4a/ndk-bundle \
|
||||
--android-api 19 \
|
||||
--ndk-version r12b \
|
||||
--arch armeabi-v7a \
|
||||
--dist-name pysolfc \
|
||||
--name ${name} \
|
||||
--bootstrap=sdl2 \
|
||||
--requirements kivy,hostpython2,random2 \
|
||||
--minsdk 14 \
|
||||
--private ${tmpdir} \
|
||||
--package ${package} \
|
||||
--version ${version} \
|
||||
--orientation sensor \
|
||||
--color=always \
|
||||
--icon ${tmpdir}/data/images/icons/48x48/pysol.png \
|
||||
--presplash ${tmpdir}/data/images/icons/1024x1024/pysol.png \
|
||||
--copy-libs
|
||||
${new_options}
|
||||
|
|
|
@ -1,56 +1,33 @@
|
|||
#!/bin/bash
|
||||
set -eux
|
||||
|
||||
. mkp4a.common
|
||||
|
||||
echo '### prepare sdk'
|
||||
|
||||
./initsdk.py $1 $2 $3
|
||||
./initsdk
|
||||
|
||||
echo '### install p4a'
|
||||
|
||||
p4adir=${HOME}/.cache/tmp-for-p4a
|
||||
mkdir -p ${p4adir}
|
||||
|
||||
p4aversion='0.5.3'
|
||||
if [ ! -f ${p4adir}/${p4aversion}.zip ]
|
||||
then
|
||||
wget "https://github.com/kivy/python-for-android/archive/${p4aversion}.zip"
|
||||
cp -a ./${p4aversion}.zip ${p4adir}/${p4aversion}.zip
|
||||
rm -f ./${p4aversion}.zip
|
||||
fi
|
||||
if [ -f ${p4adir}/${p4aversion}.zip ]
|
||||
then
|
||||
python3 -m pip install -q --user "${p4adir}/${p4aversion}.zip"
|
||||
else
|
||||
echo "### download of ${p4aversion}.zip failed"
|
||||
fi
|
||||
python3 -m pip install -q --user python-for-android
|
||||
|
||||
echo '### prepare source'
|
||||
|
||||
srcdir=${HOME}/.cache/tmp-for-p4a/pysolfc/src
|
||||
(cd .. && make rules)
|
||||
|
||||
mkdir -p ${srcdir}
|
||||
rm -rf ${srcdir}
|
||||
cp -a .. ${srcdir}
|
||||
rm -rf ${srcdir}/android
|
||||
rm -rf ${srcdir}/src
|
||||
cp -a main.py ${srcdir}/main.py
|
||||
mkdir -p ${srcdir}/data/images/cards/bottoms/trumps-only
|
||||
echo "" > ${srcdir}/data/images/cards/bottoms/trumps-only/.keep
|
||||
mkdir -p ${tmpdir}
|
||||
rm -rf ${tmpdir}
|
||||
cp -a .. ${tmpdir}
|
||||
rm -rf ${tmpdir}/android
|
||||
rm -rf ${tmpdir}/src
|
||||
cp -a main.py ${tmpdir}
|
||||
mkdir -p ${tmpdir}/data/images/cards/bottoms/trumps-only
|
||||
echo "" > ${tmpdir}/data/images/cards/bottoms/trumps-only/.keep
|
||||
|
||||
echo '### prepare cardsets'
|
||||
|
||||
cardsdir=${HOME}/.cache/tmp-for-p4a/pysolfc
|
||||
|
||||
if [ ! -d ${cardsdir}/PySolFC-Cardsets-2.0 ]
|
||||
then
|
||||
./mkcards
|
||||
mv PySolFC-Cardsets-2.0 ${cardsdir}/
|
||||
rm -f PySolFC-Cardsets-2.0.tar.bz2
|
||||
fi
|
||||
|
||||
if [ -d ${cardsdir}/PySolFC-Cardsets-2.0 ]
|
||||
then
|
||||
echo '### copying cardsets'
|
||||
cp -a ${cardsdir}/PySolFC-Cardsets-2.0/* ${srcdir}/data
|
||||
fi
|
||||
cp -a ${cardsets_dir}/* ${tmpdir}/data
|
||||
|
||||
echo '### end init'
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
. mkp4a.common
|
||||
|
||||
pass1=""
|
||||
pass2=""
|
||||
keyalias="python"
|
||||
keystore="${PWD}/bin/keystore"
|
||||
if [ $1 ]
|
||||
then
|
||||
if [ $1 ]; then
|
||||
pass1=$1
|
||||
pass2=$1
|
||||
else
|
||||
|
@ -13,16 +15,13 @@ else
|
|||
echo " (use ./mkkeystore to create one in default location)"
|
||||
exit
|
||||
fi
|
||||
if [ $2 ]
|
||||
then
|
||||
if [ $2 ]; then
|
||||
pass2=$2
|
||||
fi
|
||||
if [ $3 ]
|
||||
then
|
||||
if [ $3 ]; then
|
||||
keyalias=$3
|
||||
fi
|
||||
if [ $4 ]
|
||||
then
|
||||
if [ $4 ]; then
|
||||
keystore=$4
|
||||
fi
|
||||
|
||||
|
@ -31,30 +30,10 @@ export P4A_RELEASE_KEYSTORE_PASSWD="$pass1"
|
|||
export P4A_RELEASE_KEYALIAS_PASSWD="$pass2"
|
||||
export P4A_RELEASE_KEYALIAS="$keyalias"
|
||||
|
||||
version=`./version.py`
|
||||
tmpdir=${HOME}/.cache/tmp-for-p4a/pysolfc/src
|
||||
|
||||
python3 -m pythonforandroid.toolchain apk \
|
||||
--sdk-dir ${HOME}/.cache/sdk-for-p4a \
|
||||
--ndk-dir ${HOME}/.cache/sdk-for-p4a/ndk-bundle \
|
||||
--android-api 19 \
|
||||
--ndk-version r12b \
|
||||
--arch armeabi-v7a \
|
||||
--dist-name pysolfc \
|
||||
--name PySolFC \
|
||||
--bootstrap=sdl2 \
|
||||
--requirements kivy,hostpython2,random2 \
|
||||
${p4a_options} \
|
||||
--release \
|
||||
--sign \
|
||||
--minsdk 14 \
|
||||
--private ${tmpdir} \
|
||||
--package org.lufebe16.pysolfc \
|
||||
--version ${version} \
|
||||
--orientation sensor \
|
||||
--color=always \
|
||||
--icon ${tmpdir}/data/images/icons/48x48/pysol.png \
|
||||
--presplash ${tmpdir}/data/images/icons/1024x1024/pysol.png \
|
||||
--copy-libs
|
||||
--sign
|
||||
|
||||
# keystore options (instead environment vars):
|
||||
#
|
||||
|
|
|
@ -1,47 +1,11 @@
|
|||
#!/bin/bash
|
||||
set -eux
|
||||
|
||||
echo '### p4a started'
|
||||
|
||||
# sdk-dir and nkd-dir from command line (fdroid mode)
|
||||
|
||||
sdkdir="${HOME}/.cache/sdk-for-p4a"
|
||||
ndkdir="${HOME}/.cache/sdk-for-p4a/ndk-bundle"
|
||||
if [ $1 ]
|
||||
then
|
||||
echo "set sdk to: $1"
|
||||
sdkdir="$1"
|
||||
fi
|
||||
if [ $2 ]
|
||||
then
|
||||
echo "set ndk to: $2"
|
||||
ndkdir="$2"
|
||||
fi
|
||||
|
||||
echo '### run toolchain'
|
||||
|
||||
version=`./version.py`
|
||||
tmpdir=${HOME}/.cache/tmp-for-p4a/pysolfc/src
|
||||
. mkp4a.common
|
||||
|
||||
python3 -m pythonforandroid.toolchain apk \
|
||||
--sdk-dir ${sdkdir} \
|
||||
--ndk-dir ${ndkdir} \
|
||||
--android-api 19 \
|
||||
--ndk-version r12b \
|
||||
--arch armeabi-v7a \
|
||||
--dist-name pysolfc \
|
||||
--name PySolFC \
|
||||
--bootstrap=sdl2 \
|
||||
--requirements kivy,hostpython2,random2 \
|
||||
--release \
|
||||
--minsdk 14 \
|
||||
--private ${tmpdir} \
|
||||
--package org.lufebe16.pysolfc \
|
||||
--version ${version} \
|
||||
--orientation sensor \
|
||||
--color=always \
|
||||
--icon ${tmpdir}/data/images/icons/48x48/pysol.png \
|
||||
--presplash ${tmpdir}/data/images/icons/1024x1024/pysol.png \
|
||||
--copy-libs
|
||||
${p4a_options} \
|
||||
--release
|
||||
|
||||
# python3 -m pythonforandroid.toolchain apk
|
||||
# ...
|
||||
|
@ -53,5 +17,3 @@ python3 -m pythonforandroid.toolchain apk \
|
|||
# ohne: -> debug version
|
||||
# 1: -> release unsigned
|
||||
# 1 und 2: -> release version.
|
||||
|
||||
echo '### p4a finished'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#! /bin/sh -Cefu
|
||||
#!/bin/sh
|
||||
set -Cefu
|
||||
|
||||
: ${PKGTREE:=/usr/local/packages/PySolFC}
|
||||
PIP="$(printf '%s/env/bin/pip install --no-binary :all: ' "$PKGTREE")"
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# convert gif to png - dir recursive
|
||||
|
||||
# scharf !!!!
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
from_dir=images
|
||||
to_dir=clearlooks
|
||||
|
|
|
@ -1,39 +1,55 @@
|
|||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
# converts cardset images and config files in current
|
||||
# directory from input-format to output-format.
|
||||
# Converts cardset images and config files in subdirs of the current
|
||||
# directory from input-format to output-format (default: gif to bmp).
|
||||
#
|
||||
# example to convert from gif format to png:
|
||||
# Example to convert from gif format to png:
|
||||
#
|
||||
# $> cardconv gif png
|
||||
#
|
||||
# needs package 'ImageMagick' beeing installed.
|
||||
# Needs package 'ImageMagick' being installed.
|
||||
|
||||
ifo=''
|
||||
if [ $1 ]
|
||||
then
|
||||
ifo='gif'
|
||||
ofo='bmp'
|
||||
|
||||
if [ $# -eq 2 ]; then
|
||||
ifo=$1
|
||||
else
|
||||
echo 'use: cardconv <input-format> <output-format>'
|
||||
exit
|
||||
fi
|
||||
|
||||
ofo=''
|
||||
if [ $2 ]
|
||||
then
|
||||
ofo=$2
|
||||
else
|
||||
echo 'use: cardconv <input-format> <output-format>'
|
||||
exit
|
||||
elif [ $# -ne 0 ]; then
|
||||
echo "Usage: cardconv [INPUTFORMAT OUTPUTFORMAT]"
|
||||
echo "If formats are not specified, converts $ifo to $ofo."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# alle images.
|
||||
for i in *.${ifo}; do convert $i `basename $i .${ifo}`.${ofo}; rm -f $i; done
|
||||
# Returns true if $1/config.txt exists and contains a mention of the input format
|
||||
# file extension.
|
||||
chkdir() {
|
||||
grep -qi "\.${ifo}" "${1}/config".txt
|
||||
return $?
|
||||
}
|
||||
|
||||
# config.txt
|
||||
if [ -f config.txt ]
|
||||
then
|
||||
cp -a config.txt tmp.txt
|
||||
cat tmp.txt | sed "s/.${ifo}/.${ofo}/g" >config.txt
|
||||
rm -f tmp.txt
|
||||
# Usage: convdir in_dir out_dir
|
||||
convdir() {
|
||||
mkdir -p "$2"
|
||||
|
||||
# Convert all images
|
||||
for i in $1/*.$ifo; do
|
||||
convert "$i" "$2/$(basename $i .$ifo).$ofo"
|
||||
done
|
||||
|
||||
# Convert config.txt
|
||||
if [ -f $1/config.txt ]; then
|
||||
sed "s/\.${ifo}/.${ofo}/g" $1/config.txt > $2/config.txt
|
||||
fi
|
||||
}
|
||||
|
||||
# Check all cardsets.
|
||||
for in_dir in cardset-*; do
|
||||
out_dir=${in_dir}-${ofo}
|
||||
|
||||
if [[ ! $in_dir =~ -$ofo$ ]] && [ ! -d $out_dir ] && chkdir $in_dir; then
|
||||
convdir $in_dir $out_dir
|
||||
echo "$out_dir created"
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# creates a bmp copy off all gif cardsets in the current dir.
|
||||
# uses package 'ImageMagick'
|
||||
|
||||
ifo='gif'
|
||||
if [ $1 ]
|
||||
then
|
||||
ifo=$1
|
||||
fi
|
||||
|
||||
ofo='bmp'
|
||||
if [ $2 ]
|
||||
then
|
||||
ofo=$2
|
||||
fi
|
||||
|
||||
function chkdir()
|
||||
{
|
||||
# convert all images
|
||||
cd $1
|
||||
if [ -f config.txt ]
|
||||
then
|
||||
g=`grep -i ".${ifo}" config.txt`
|
||||
#echo $g
|
||||
if [[ $g == "" ]]
|
||||
then
|
||||
cd ..
|
||||
return 1
|
||||
else
|
||||
cd ..
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
cd ..
|
||||
return 0
|
||||
}
|
||||
|
||||
function convdir()
|
||||
{
|
||||
# convert all images
|
||||
for i in *.${ifo}; do convert $i `basename $i .${ifo}`.${ofo}; rm -f $i; done
|
||||
|
||||
# convert config.txt
|
||||
if [ -f config.txt ]
|
||||
then
|
||||
cp -a config.txt tmp.txt
|
||||
cat tmp.txt | sed "s/.${ifo}/.${ofo}/g" >config.txt
|
||||
rm -f tmp.txt
|
||||
fi
|
||||
}
|
||||
|
||||
# check all cardsets.
|
||||
|
||||
for k in cardset-*
|
||||
do
|
||||
x=${k%-bmp}
|
||||
y=$x-${ofo}
|
||||
|
||||
if chkdir $k
|
||||
then
|
||||
if [ $k != $y ]
|
||||
then
|
||||
if [ -a $y ]
|
||||
then
|
||||
echo "$y exists already - skipped"
|
||||
else
|
||||
echo "$y processing ..."
|
||||
cp -a $k $y
|
||||
cd $y
|
||||
convdir
|
||||
cd ..
|
||||
echo "$y created"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
|
@ -1,4 +1,6 @@
|
|||
#! /bin/sh
|
||||
set -e
|
||||
|
||||
#
|
||||
# y.sh
|
||||
# Copyright (C) 2018 shlomif <shlomif@cpan.org>
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Functioned-out - may be useful later.
|
||||
proc_path()
|
||||
{
|
||||
PATH="$(perl -lE 'my @p = split/:/,$ENV{PATH}; print join q#:#, grep { ! m#\A/opt/python# } @p;')" "$@"
|
||||
}
|
||||
make test || exit -1
|
||||
make dist || exit -1
|
||||
tar -xvf dist/PySolFC-*.tar.xz || exit -1
|
||||
(cd PySolFC-*/ && make test) || exit -1
|
||||
make test
|
||||
make dist
|
||||
tar -xvf dist/PySolFC-*.tar.xz
|
||||
(cd PySolFC-*/ && make test)
|
||||
|
|
Loading…
Add table
Reference in a new issue