~kaozilon/totem/test

« back to all changes in this revision

Viewing changes to build-aux/py-compile

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-05-26 00:07:51 UTC
  • mfrom: (1.6.1) (24.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20130526000751-kv8ap3x1di4qq8j2
Tags: 3.8.2-0ubuntu1
* Sync with Debian. Remaining changes: 
* debian/control.in:
  - Drop build-depends on libepc-ui-dev and libgrilo-0.2-dev (in universe)
  - Drop libxtst-dev build-depends so that the (redundant) fake key presses
    for inhibiting the screensaver are disabled (LP: #1007438)
  - Build-depend on libzeitgeist-dev
  - Suggest rather than recommend gstreamer components in universe
  - Add totem-plugins-extra
  - Add XB-Npp-Description and XB-Npp-Filename header to the 
    totem-mozilla package to improve ubufox/ubuntu plugin db integration 
  - Refer to Firefox in totem-mozilla description instead of Iceweasel
  - Don't have totem-mozilla recommend any particular browser
  - Drop obsolete python library dependencies since iplayer is no longer
    included
* debian/totem-common.install, debian/source_totem.py:
  - Install Ubuntu apport debugging hook
* debian/totem-plugins-extra.install:
  - Universe plugins split out of totem-plugins (currently only gromit)
* debian/totem-plugins.install:    
  - Skip the plugins split to -extra and add the zeitgeist plugin
* debian/rules:
  - Build with --fail-missing, to ensure we install everything. 
    + Ignore libtotem.{,l}a since we delibrately don't install these.
  - Re-enable hardening, make sure both PIE and BINDNOW are used
    by setting hardening=+all. (LP: #1039604)
* debian/patches/91_quicklist_entries.patch:
  - Add static quicklist
* debian/patches/92_gst-plugins-good.patch:
  - Build without unnecessary gstreamer1.0-bad dependency
* debian/patches/93_grilo_optional.patch:
  - Allow building without grilo while grilo MIR is still pending
* debian/patches/correct_desktop_mimetypes.patch:
  - Don't list the mimetypes after the unity lists
* debian/patches/revert_shell_menu.patch: 
  - revert the use of a shell menu until indicator-appmenu can handle
    the mixed shell/traditional menus itself
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# py-compile - Compile a Python program
 
3
 
 
4
scriptversion=2011-06-08.12; # UTC
 
5
 
 
6
# Copyright (C) 2000-2013 Free Software Foundation, Inc.
 
7
 
 
8
# This program is free software; you can redistribute it and/or modify
 
9
# it under the terms of the GNU General Public License as published by
 
10
# the Free Software Foundation; either version 2, or (at your option)
 
11
# any later version.
 
12
 
 
13
# This program is distributed in the hope that it will be useful,
 
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
# GNU General Public License for more details.
 
17
 
 
18
# You should have received a copy of the GNU General Public License
 
19
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
20
 
 
21
# As a special exception to the GNU General Public License, if you
 
22
# distribute this file as part of a program that contains a
 
23
# configuration script generated by Autoconf, you may include it under
 
24
# the same distribution terms that you use for the rest of that program.
 
25
 
 
26
# This file is maintained in Automake, please report
 
27
# bugs to <bug-automake@gnu.org> or send patches to
 
28
# <automake-patches@gnu.org>.
 
29
 
 
30
if [ -z "$PYTHON" ]; then
 
31
  PYTHON=python
 
32
fi
 
33
 
 
34
me=py-compile
 
35
 
 
36
usage_error ()
 
37
{
 
38
  echo "$me: $*" >&2
 
39
  echo "Try '$me --help' for more information." >&2
 
40
  exit 1
 
41
}
 
42
 
 
43
basedir=
 
44
destdir=
 
45
while test $# -ne 0; do
 
46
  case "$1" in
 
47
    --basedir)
 
48
      if test $# -lt 2; then
 
49
        usage_error "option '--basedir' requires an argument"
 
50
      else
 
51
        basedir=$2
 
52
      fi
 
53
      shift
 
54
      ;;
 
55
    --destdir)
 
56
      if test $# -lt 2; then
 
57
        usage_error "option '--destdir' requires an argument"
 
58
      else
 
59
        destdir=$2
 
60
      fi
 
61
      shift
 
62
      ;;
 
63
    -h|--help)
 
64
      cat <<\EOF
 
65
Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..."
 
66
 
 
67
Byte compile some python scripts FILES.  Use --destdir to specify any
 
68
leading directory path to the FILES that you don't want to include in the
 
69
byte compiled file.  Specify --basedir for any additional path information you
 
70
do want to be shown in the byte compiled file.
 
71
 
 
72
Example:
 
73
  py-compile --destdir /tmp/pkg-root --basedir /usr/share/test test.py test2.py
 
74
 
 
75
Report bugs to <bug-automake@gnu.org>.
 
76
EOF
 
77
      exit $?
 
78
      ;;
 
79
    -v|--version)
 
80
      echo "$me $scriptversion"
 
81
      exit $?
 
82
      ;;
 
83
    --)
 
84
      shift
 
85
      break
 
86
      ;;
 
87
    -*)
 
88
      usage_error "unrecognized option '$1'"
 
89
      ;;
 
90
    *)
 
91
      break
 
92
      ;;
 
93
  esac
 
94
  shift
 
95
done
 
96
 
 
97
files=$*
 
98
if test -z "$files"; then
 
99
    usage_error "no files given"
 
100
fi
 
101
 
 
102
# if basedir was given, then it should be prepended to filenames before
 
103
# byte compilation.
 
104
if [ -z "$basedir" ]; then
 
105
    pathtrans="path = file"
 
106
else
 
107
    pathtrans="path = os.path.join('$basedir', file)"
 
108
fi
 
109
 
 
110
# if destdir was given, then it needs to be prepended to the filename to
 
111
# byte compile but not go into the compiled file.
 
112
if [ -z "$destdir" ]; then
 
113
    filetrans="filepath = path"
 
114
else
 
115
    filetrans="filepath = os.path.normpath('$destdir' + os.sep + path)"
 
116
fi
 
117
 
 
118
$PYTHON -c "
 
119
import sys, os, py_compile, imp
 
120
 
 
121
files = '''$files'''
 
122
 
 
123
sys.stdout.write('Byte-compiling python modules...\n')
 
124
for file in files.split():
 
125
    $pathtrans
 
126
    $filetrans
 
127
    if not os.path.exists(filepath) or not (len(filepath) >= 3
 
128
                                            and filepath[-3:] == '.py'):
 
129
            continue
 
130
    sys.stdout.write(file)
 
131
    sys.stdout.flush()
 
132
    if hasattr(imp, 'get_tag'):
 
133
        py_compile.compile(filepath, imp.cache_from_source(filepath), path)
 
134
    else:
 
135
        py_compile.compile(filepath, filepath + 'c', path)
 
136
sys.stdout.write('\n')" || exit $?
 
137
 
 
138
# this will fail for python < 1.5, but that doesn't matter ...
 
139
$PYTHON -O -c "
 
140
import sys, os, py_compile, imp
 
141
 
 
142
# pypy does not use .pyo optimization
 
143
if hasattr(sys, 'pypy_translation_info'):
 
144
    sys.exit(0)
 
145
 
 
146
files = '''$files'''
 
147
sys.stdout.write('Byte-compiling python modules (optimized versions) ...\n')
 
148
for file in files.split():
 
149
    $pathtrans
 
150
    $filetrans
 
151
    if not os.path.exists(filepath) or not (len(filepath) >= 3
 
152
                                            and filepath[-3:] == '.py'):
 
153
            continue
 
154
    sys.stdout.write(file)
 
155
    sys.stdout.flush()
 
156
    if hasattr(imp, 'get_tag'):
 
157
        py_compile.compile(filepath, imp.cache_from_source(filepath, False), path)
 
158
    else:
 
159
        py_compile.compile(filepath, filepath + 'o', path)
 
160
sys.stdout.write('\n')" 2>/dev/null || :
 
161
 
 
162
# Local Variables:
 
163
# mode: shell-script
 
164
# sh-indentation: 2
 
165
# eval: (add-hook 'write-file-hooks 'time-stamp)
 
166
# time-stamp-start: "scriptversion="
 
167
# time-stamp-format: "%:y-%02m-%02d.%02H"
 
168
# time-stamp-time-zone: "UTC"
 
169
# time-stamp-end: "; # UTC"
 
170
# End: