checkdistribution.py :  » Development » MPI-Python » pyMPI-2.5b0 » utils » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Development » MPI Python 
MPI Python » pyMPI 2.5b0 » utils » checkdistribution.py
import sys
import os
import string

def getCVSTree(directory):
    files = []
    try:
        f = open(os.path.join(directory,'CVS','Entries'))
    except IOError:
        pass
    else:
        for line in f.xreadlines():
            print 'try %r in %r'%(line,directory)
            try:
                actor = os.path.join(directory,line.split('/')[1])
            except:
                continue

            if line[:1] == '/':
                files.append(actor)
            elif line[:1] == 'D':
                files = files + getCVSTree(actor)
    return files


if __name__ == '__main__':
    # -----------------------------------------------
    # Name of the XXXXX.tar.gz file
    # -----------------------------------------------
    tgz = sys.argv[1]
    open(tgz) # Will verify existance

    # -----------------------------------------------
    # Name without the tar.gz extension
    # -----------------------------------------------
    name = string.join(tgz.split(os.extsep)[:-2],os.extsep)

    # -----------------------------------------------
    # Read out all the names (titles) in the file
    # -----------------------------------------------
    pipe = os.popen('gunzip -c %s | tar tf -'%tgz)
    tar_files = pipe.read().split()
    status = pipe.close()
    if status is not None: sys.exit(status)

    # -----------------------------------------------
    # Walk through the CVS tree and verify that each name
    # exists
    # -----------------------------------------------
    CVS_files = getCVSTree(os.curdir)
    CVS_files.sort()
    status = 0
    missing = []
    for x in CVS_files:
        lookup = name+x[len(os.curdir):]
        if lookup not in tar_files:
            missing.append(x[len(os.curdir)+len(os.sep):])
            status = 1

    # -----------------------------------------------
    # Merge the old list and the new list
    # -----------------------------------------------
    if status:
        extra_dist = sys.argv[2:]+missing
        extra_dist.sort()
        top_level = [x for x in extra_dist if os.sep not in x]
        sub_level = [x for x in extra_dist if os.sep in x]
        last_directory = None
        print 'EXTRA_DIST =',
        sorted = top_level + sub_level
        for x in sorted:
            directory,base = os.path.split(x)
            if x in  ['boot']: continue
            if directory in ['tests','experimental','obsolete']: continue

            if directory and directory == last_directory:
                tab = '\t\t'
            else:
                tab = '\t'
            last_directory = directory

            if x in missing:
                miss = '*'
            else:
                miss = ''
            sys.stdout.write(' \\\n%s%s%s'%(miss,tab,x))
        print


    sys.exit(status)

    
    
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.