~timo-jyrinki/ubuntu/trusty/pitivi/backport_utopic_fixes

« back to all changes in this revision

Viewing changes to py-compile

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2014-04-05 15:28:16 UTC
  • mfrom: (6.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20140405152816-6lijoax4cngiz5j5
Tags: 0.93-3
* debian/control:
  + Depend on python-gi (>= 3.10), older versions do not work
    with pitivi (Closes: #732813).
  + Add missing dependency on gir1.2-clutter-gst-2.0 (Closes: #743692).
  + Add suggests on gir1.2-notify-0.7 and gir1.2-gnomedesktop-3.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
# py-compile - Compile a Python program
3
3
 
4
 
scriptversion=2009-04-28.21; # UTC
 
4
scriptversion=2011-06-08.12; # UTC
5
5
 
6
 
# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2008, 2009 Free Software
7
 
# Foundation, Inc.
 
6
# Copyright (C) 2000-2013 Free Software Foundation, Inc.
8
7
 
9
8
# This program is free software; you can redistribute it and/or modify
10
9
# it under the terms of the GNU General Public License as published by
32
31
  PYTHON=python
33
32
fi
34
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
 
35
43
basedir=
36
44
destdir=
37
 
files=
38
45
while test $# -ne 0; do
39
46
  case "$1" in
40
47
    --basedir)
41
 
      basedir=$2
42
 
      if test -z "$basedir"; then
43
 
        echo "$0: Missing argument to --basedir." 1>&2
44
 
        exit 1
 
48
      if test $# -lt 2; then
 
49
        usage_error "option '--basedir' requires an argument"
 
50
      else
 
51
        basedir=$2
45
52
      fi
46
53
      shift
47
54
      ;;
48
55
    --destdir)
49
 
      destdir=$2
50
 
      if test -z "$destdir"; then
51
 
        echo "$0: Missing argument to --destdir." 1>&2
52
 
        exit 1
 
56
      if test $# -lt 2; then
 
57
        usage_error "option '--destdir' requires an argument"
 
58
      else
 
59
        destdir=$2
53
60
      fi
54
61
      shift
55
62
      ;;
56
 
    -h|--h*)
 
63
    -h|--help)
57
64
      cat <<\EOF
58
65
Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..."
59
66
 
69
76
EOF
70
77
      exit $?
71
78
      ;;
72
 
    -v|--v*)
73
 
      echo "py-compile $scriptversion"
 
79
    -v|--version)
 
80
      echo "$me $scriptversion"
74
81
      exit $?
75
82
      ;;
 
83
    --)
 
84
      shift
 
85
      break
 
86
      ;;
 
87
    -*)
 
88
      usage_error "unrecognized option '$1'"
 
89
      ;;
76
90
    *)
77
 
      files="$files $1"
 
91
      break
78
92
      ;;
79
93
  esac
80
94
  shift
81
95
done
82
96
 
 
97
files=$*
83
98
if test -z "$files"; then
84
 
    echo "$0: No files given.  Try \`$0 --help' for more information." 1>&2
85
 
    exit 1
 
99
    usage_error "no files given"
86
100
fi
87
101
 
88
102
# if basedir was given, then it should be prepended to filenames before
102
116
fi
103
117
 
104
118
$PYTHON -c "
105
 
import sys, os, py_compile
 
119
import sys, os, py_compile, imp
106
120
 
107
121
files = '''$files'''
108
122
 
115
129
            continue
116
130
    sys.stdout.write(file)
117
131
    sys.stdout.flush()
118
 
    py_compile.compile(filepath, filepath + 'c', path)
 
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)
119
136
sys.stdout.write('\n')" || exit $?
120
137
 
121
138
# this will fail for python < 1.5, but that doesn't matter ...
122
139
$PYTHON -O -c "
123
 
import sys, os, py_compile
 
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)
124
145
 
125
146
files = '''$files'''
126
147
sys.stdout.write('Byte-compiling python modules (optimized versions) ...\n')
132
153
            continue
133
154
    sys.stdout.write(file)
134
155
    sys.stdout.flush()
135
 
    py_compile.compile(filepath, filepath + 'o', path)
 
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)
136
160
sys.stdout.write('\n')" 2>/dev/null || :
137
161
 
138
162
# Local Variables: