]> granicus.if.org Git - python/commitdiff
When regenerating files like Python-ast.h, take care that the generated
authorArmin Rigo <arigo@tunes.org>
Wed, 14 Dec 2005 18:05:14 +0000 (18:05 +0000)
committerArmin Rigo <arigo@tunes.org>
Wed, 14 Dec 2005 18:05:14 +0000 (18:05 +0000)
comment based on 'sys.args[0]' does not depend on the path.  For Python
builds from a remote directory ("/path/to/configure; make") the previous
logic used to include the "/path/to" portion in Python-ast.h.  Then svn
would consider this file to be locally modified.

Parser/asdl_c.py

index 2167c30542927d221a0f138500487282c3d85ead..f45bee450ca388808b40c0748fc1f3d76d156a30 100755 (executable)
@@ -639,9 +639,8 @@ class ChainOfVisitors:
 
 def main(srcfile):
     argv0 = sys.argv[0]
-    index = argv0.find('/')
-    if index > 0:
-        argv0 = argv0[index + 1:]
+    components = argv0.split(os.sep)
+    argv0 = os.sep.join(components[-2:])
     auto_gen_msg = '/* File automatically generated by %s */\n' % argv0
     mod = asdl.parse(srcfile)
     if not asdl.check(mod):