source: py-compile @ aa3c8b7

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since aa3c8b7 was 96fb8ad, checked in by Paul Brossier <piem@altern.org>, 20 years ago

import 0.1.7.1

  • Property mode set to 100755
File size: 3.0 KB
RevLine 
[96fb8ad]1#!/bin/sh
2# py-compile - Compile a Python program
3
4scriptversion=2004-01-12.23
5
6# Copyright (C) 2000, 2001, 2003, 2004  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, write to the Free Software
20# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21# 02111-1307, USA.
22
23# As a special exception to the GNU General Public License, if you
24# distribute this file as part of a program that contains a
25# configuration script generated by Autoconf, you may include it under
26# the same distribution terms that you use for the rest of that program.
27
28# This file is maintained in Automake, please report
29# bugs to <bug-automake@gnu.org> or send patches to
30# <automake-patches@gnu.org>.
31
32if [ -z "$PYTHON" ]; then
33  PYTHON=python
34fi
35
36basedir=
37
38case "$1" in
39  --basedir)
40    basedir=$2
41    if test -z "$basedir"; then
42      echo "$0: Missing argument to --basedir." 1>&2
43      exit 1
44    fi
45    shift 2
46    ;;
47  -h|--h*)
48    cat <<\EOF
49Usage: py-compile [--help] [--version] [--basedir DIR] FILES..."
50
51Byte compile some python scripts FILES.  This should be performed
52after they have been moved to the final installation location
53
54Report bugs to <bug-automake@gnu.org>.
55EOF
56    exit 0
57    ;;
58  -v|--v*)
59    echo "py-compile $scriptversion"
60    exit 0
61    ;;
62esac
63
64if [ $# = 0 ]; then
65    echo "$0: No files given.  Try \`$0 --help' for more information." 1>&2
66    exit 1
67fi
68
69# if basedir was given, then it should be prepended to filenames before
70# byte compilation.
71if [ -z "$basedir" ]; then
72    trans="path = file"
73else
74    trans="path = os.path.join('$basedir', file)"
75fi
76
77$PYTHON -c "
78import sys, os, string, py_compile
79
80files = '''$*'''
81print 'Byte-compiling python modules...'
82for file in string.split(files):
83    $trans
84    if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'):
85        continue
86    print file,
87    sys.stdout.flush()
88    py_compile.compile(path)
89print" || exit $?
90
91# this will fail for python < 1.5, but that doesn't matter ...
92$PYTHON -O -c "
93import sys, os, string, py_compile
94
95files = '''$*'''
96print 'Byte-compiling python modules (optimized versions) ...'
97for file in string.split(files):
98    $trans
99    if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'):
100        continue
101    print file,
102    sys.stdout.flush()
103    py_compile.compile(path)
104print" 2>/dev/null || :
105
106# Local Variables:
107# mode: shell-script
108# sh-indentation: 2
109# eval: (add-hook 'write-file-hooks 'time-stamp)
110# time-stamp-start: "scriptversion="
111# time-stamp-format: "%:y-%02m-%02d.%02H"
112# time-stamp-end: "$"
113# End:
Note: See TracBrowser for help on using the repository browser.