[xiph-cvs] cvs commit: vorbis-python ChangeLog README config_unix.py
Andrew Catham Master of Python
andrew at xiph.org
Sun Dec 9 11:47:08 PST 2001
andrew 01/12/09 11:47:08
Modified: . ChangeLog README config_unix.py
Log:
2001-12-09 Andrew H. Chatham <andrew.chatham at duke.edu>
* config_unix.py: Better logging and finer-grained path arguments
Revision Changes Path
1.6 +3 -0 vorbis-python/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/vorbis-python/ChangeLog,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ChangeLog 2001/09/02 18:21:12 1.5
+++ ChangeLog 2001/12/09 19:47:07 1.6
@@ -1,3 +1,6 @@
+2001-12-09 Andrew H. Chatham <andrew.chatham at duke.edu>
+ * config_unix.py: Better logging and finer-grained path arguments
+
2001-09-02 Andrew H. Chatham <andrew.chatham at duke.edu>
* setup.py: bumped version number to 0.4
1.2 +4 -1 vorbis-python/README
Index: README
===================================================================
RCS file: /usr/local/cvsroot/vorbis-python/README,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- README 2001/02/06 03:20:48 1.1
+++ README 2001/12/09 19:47:07 1.2
@@ -25,7 +25,10 @@
run "python setup.py build" to build and then as root run "python
setup.py install". You may need to run config_unix.py with a
"--prefix" option if you installed your ogg or vorbis libraries in a
-weird place.
+weird place. You can also pass --with-ogg-dir and --with-vorbis-dir
+arguments if they're installed separately. If you have problems with
+the configure script, check the output of conifg.log for specific
+errors.
To decode, you'll basically want to create a VorbisFile object and
read data from that. You can then write the data to a sound
1.2 +63 -24 vorbis-python/config_unix.py
Index: config_unix.py
===================================================================
RCS file: /usr/local/cvsroot/vorbis-python/config_unix.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- config_unix.py 2001/02/06 03:20:48 1.1
+++ config_unix.py 2001/12/09 19:47:07 1.2
@@ -3,14 +3,28 @@
import string
import os
import sys
+import exceptions
+log_name = 'config.log'
+if os.path.isfile(log_name):
+ os.unlink(log_name)
+
+def write_log(msg):
+ log_file = open(log_name, 'a')
+ log_file.write(msg)
+ log_file.write('\n')
+ log_file.close()
+
+def exit(code=0):
+ sys.exit(code)
+
def msg_checking(msg):
print "Checking", msg, "...",
-def execute(cmd, display = 0):
- if display:
- print cmd
- return os.system(cmd)
+def execute(cmd):
+ write_log("Execute: %s" % cmd)
+ full_cmd = '%s 1>>%s 2>&1' % (cmd, log_name)
+ return os.system(full_cmd)
def run_test(input, flags = ''):
try:
@@ -19,9 +33,10 @@
f.close()
compile_cmd = '%s -o _temp _temp.c %s' % (os.environ.get('CC', 'cc'),
flags)
+ write_log("executing test: %s" % compile_cmd)
if not execute(compile_cmd):
execute('./_temp')
-
+
finally:
execute('rm -f _temp.c _temp')
@@ -48,13 +63,13 @@
msg_checking('for Ogg')
if enable_oggtest:
- execute('rm -f conf.oggtest', 0)
+ execute('rm -f conf.oggtest')
try:
- run_test(ogg_test_program)
+ run_test(ogg_test_program, flags="-I" + ogg_include_dir)
if not os.path.isfile('conf.oggtest'):
raise RuntimeError, "Did not produce output"
- execute('rm conf.oggtest', 0)
+ execute('rm conf.oggtest')
except:
print "test program failed"
@@ -80,9 +95,15 @@
}
'''
-def find_vorbis(vorbis_prefix = '/usr/local', enable_vorbistest = 1):
+def find_vorbis(ogg_data,
+ vorbis_prefix = '/usr/local',
+ enable_vorbistest = 1):
"""A rough translation of vorbis.m4"""
+ ogg_libs = ogg_data['ogg_libs']
+ ogg_lib_dir = ogg_data['ogg_lib_dir']
+ ogg_include_dir = ogg_data['ogg_include_dir']
+
vorbis_include_dir = vorbis_prefix + '/include'
vorbis_lib_dir = vorbis_prefix + '/lib'
vorbis_libs = 'vorbis vorbisfile vorbisenc'
@@ -90,13 +111,15 @@
msg_checking('for Vorbis')
if enable_vorbistest:
- execute('rm -f conf.vorbistest', 0)
+ execute('rm -f conf.vorbistest')
try:
- run_test(vorbis_test_program)
+ run_test(vorbis_test_program,
+ flags = "-I%s -I%s" % (vorbis_include_dir,
+ ogg_include_dir))
if not os.path.isfile('conf.vorbistest'):
raise RuntimeError, "Did not produce output"
- execute('rm conf.vorbistest', 0)
+ execute('rm conf.vorbistest')
except:
print "test program failed"
@@ -117,38 +140,54 @@
def print_help():
print '''%s
- --prefix Give the prefix in which vorbis was installed.''' % sys.argv[0]
- sys.exit(0)
+ --prefix Give the prefix in which vorbis was installed.
+ --with-ogg-dir [dir] Give the directory for ogg files
+ (separated by a space)
+ --with-vorbis-dir [dir] Give the directory for vorbis files''' % sys.argv[0]
+ exit()
def parse_args():
+ def arg_check(data, argv, pos, arg_type, key):
+ "Register an command line arg which takes an argument"
+ if len(argv) == pos:
+ print arg_type, "needs an argument"
+ exit(1)
+ data[key] = argv[pos]
+
data = {}
argv = sys.argv
for pos in range(len(argv)):
if argv[pos] == '--help':
print_help()
+ if argv[pos] == '--with-ogg-dir':
+ pos = pos + 1
+ arg_check(data, argv, pos, "Ogg dir", 'ogg_prefix')
+ if argv[pos] == '--with-vorbis-dir':
+ pos = pos + 1
+ arg_check(data, argv, pos, "Vorbis dir", 'vorbis_prefix')
if argv[pos] == '--prefix':
pos = pos + 1
- if len(argv) == pos:
- print "Prefix needs an argument"
- sys.exit(1)
- data['prefix'] = argv[pos]
+ arg_check(data, argv, pos, "Prefix", 'prefix')
return data
def main():
args = parse_args()
prefix = args.get('prefix', '/usr/local')
+ vorbis_prefix = args.get('vorbis_prefix', prefix)
+ ogg_prefix = args.get('ogg_prefix', prefix)
- data = find_vorbis(vorbis_prefix = prefix)
+ data = find_ogg(ogg_prefix = ogg_prefix)
if not data:
print "Config failure"
- sys.exit(1)
+ exit(1)
- ogg_data = find_ogg(ogg_prefix = prefix)
- if not ogg_data:
+ vorbis_data = find_vorbis(ogg_data = data,
+ vorbis_prefix = vorbis_prefix)
+ if not vorbis_data:
print "Config failure"
- sys.exit(1)
- data.update(ogg_data)
+ exit(1)
+ data.update(vorbis_data)
write_data(data)
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list