activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r654225 - /activemq/scripts/copy_snapshot.py
Date Wed, 07 May 2008 19:32:15 GMT
Author: jstrachan
Date: Wed May  7 12:32:15 2008
New Revision: 654225

URL: http://svn.apache.org/viewvc?rev=654225&view=rev
Log:
Added a slightly more generic snapshot copy method

Added:
    activemq/scripts/copy_snapshot.py   (with props)

Added: activemq/scripts/copy_snapshot.py
URL: http://svn.apache.org/viewvc/activemq/scripts/copy_snapshot.py?rev=654225&view=auto
==============================================================================
--- activemq/scripts/copy_snapshot.py (added)
+++ activemq/scripts/copy_snapshot.py Wed May  7 12:32:15 2008
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+
+# This script copies maven snapshot files that publish to the m2 repository to a directory
+import fnmatch
+import os
+import sys
+import shutil
+
+def copy_snapshot(src, dest, postfix):
+    ending = 'SNAPSHOT' + postfix
+    match = '*' + postfix
+
+    for root, dirs, files in os.walk(src):
+        files.sort();
+        filename = 'NULL'
+        dirname = '';
+        for file in files:
+            if not fnmatch.fnmatch(file, match):
+                continue
+            filename = file
+        # get the lastest xsd file
+        if filename == 'NULL':
+            continue
+        # skip the time stamp, take of the two last - get the target file name
+        list = filename.split('-');
+        # check if the file's name is end with SNAPSHOT
+        # or removing the last two time stamps
+        
+        if list.pop()!= ending:
+            list.pop();
+        list.append(ending)
+        srcfile= os.path.join(root,filename)
+        destfile = os.path.join(dest,'-'.join(list))
+        shutil.copyfile(srcfile,destfile)
+        # disable the output
+        # print 'copy %s to %s' %(srcfile, destfile);
+
+
+def main():
+    if len(sys.argv) < 4:
+        print 'copy_snapshot_xsd.py SRC DES postfix'\
+              'copy the last snapshot file from SRC directory to DES directory which ends
with the postfix'\
+              'with the file name end with SNAPSHOT.postfix'
+        sys.exit();
+    copy_snapshot(sys.argv[1], sys.argv[2], sys.argv[3]);
+    
+
+if __name__ == '__main__':
+  sys.exit(main())

Propchange: activemq/scripts/copy_snapshot.py
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message