File: test-builder-python.sh

package info (click to toggle)
flatpak-builder 1.0.12-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 3,580 kB
  • sloc: ansic: 23,288; sh: 5,793; xml: 1,718; makefile: 114; python: 6
file content (64 lines) | stat: -rwxr-xr-x 1,876 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
#
# Copyright (C) 2011 Colin Walters <walters@verbum.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

set -euo pipefail

. $(dirname $0)/libtest.sh

skip_without_fuse
skip_without_python2

echo "1..2"

setup_repo
install_repo
setup_python2_repo
install_python2_repo

# Need /var/tmp cwd for xattrs
REPO=`pwd`/repo
cd $TEST_DATA_DIR/

cp $(dirname $0)/org.test.Python.json .
cp $(dirname $0)/org.test.Python2.json .
cp -a $(dirname $0)/empty-configure .
cp -a $(dirname $0)/testpython.py .
cp $(dirname $0)/importme.py .
cp $(dirname $0)/importme2.py .
chmod u+w *.py
flatpak-builder --force-clean appdir org.test.Python.json

assert_has_file appdir/files/bin/importme.pyc

flatpak-builder --run appdir org.test.Python.json testpython.py > testpython.out

assert_file_has_content testpython.out ^modified$

echo "ok handled pyc rewriting multiple times"

flatpak-builder --force-clean appdir org.test.Python2.json

assert_not_has_file appdir/files/bin/importme.py
assert_has_file appdir/files/bin/importme.pyc

flatpak-builder --run appdir org.test.Python2.json testpython.py > testpython.out

assert_file_has_content testpython.out "^first   $"

echo "ok handled .pyc without .py"