commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r9826 - trunk/gnue-common/src/setup


From: johannes
Subject: [gnue] r9826 - trunk/gnue-common/src/setup
Date: Thu, 22 Nov 2007 02:48:50 -0600 (CST)

Author: johannes
Date: 2007-11-22 02:48:49 -0600 (Thu, 22 Nov 2007)
New Revision: 9826

Modified:
   trunk/gnue-common/src/setup/ChangeLog.py
   trunk/gnue-common/src/setup/GSetup.py
Log:
Reindentation


Modified: trunk/gnue-common/src/setup/ChangeLog.py
===================================================================
--- trunk/gnue-common/src/setup/ChangeLog.py    2007-11-21 14:08:59 UTC (rev 
9825)
+++ trunk/gnue-common/src/setup/ChangeLog.py    2007-11-22 08:48:49 UTC (rev 
9826)
@@ -31,50 +31,50 @@
 # -----------------------------------------------------------------------------
 
 class Parser:
-  def __init__ (self, input, output):
+    def __init__ (self, input, output):
 
-    self.out = output
-    self.package = os.path.basename (os.getcwd ())
+        self.out = output
+        self.package = os.path.basename (os.getcwd ())
 
-    p = xml.parsers.expat.ParserCreate ()
+        p = xml.parsers.expat.ParserCreate ()
 
-    p.StartElementHandler = self.start_element
-    p.EndElementHandler = self.end_element
-    p.CharacterDataHandler = self.char_data
+        p.StartElementHandler = self.start_element
+        p.EndElementHandler = self.end_element
+        p.CharacterDataHandler = self.char_data
 
-    p.ParseFile (input)
+        p.ParseFile (input)
 
-    self.paths = []
-    self.revision = ''
+        self.paths = []
+        self.revision = ''
 
-  # 3 handler functions
-  def start_element (self, name, attrs):
-    self.text = ''
-    if name == 'logentry':
-      self.revision = string.ljust (attrs ['revision'], 5)
-    elif name == 'paths':
-      self.paths = []
+    # 3 handler functions
+    def start_element (self, name, attrs):
+        self.text = ''
+        if name == 'logentry':
+            self.revision = string.ljust (attrs ['revision'], 5)
+        elif name == 'paths':
+            self.paths = []
 
-  def end_element (self, name):
-    if name == 'logentry':
-      self.out.write ('\n')
-    elif name == 'author':
-      self.author = self.text
-    elif name == 'path':
-      p = string.split (self.text, '/', 3)
-      if len (p) == 4:
-        if p [2] == self.package:
-          self.paths.append (p [3])
-    elif name == 'msg':
-      self.out.write ('%s  Rev %s  %s\n\n' % \
-                      (self.date, self.revision, self.author))
-      text = '%s: %s' % (string.join (self.paths, ', '), self.text)
-      self.out.write ('\t* %s' % linewrap (text))
-    elif name == 'date':
-      self.date = self.text[:10] + ' ' + self.text[11:19]
+    def end_element (self, name):
+        if name == 'logentry':
+            self.out.write ('\n')
+        elif name == 'author':
+            self.author = self.text
+        elif name == 'path':
+            p = string.split (self.text, '/', 3)
+            if len (p) == 4:
+                if p [2] == self.package:
+                    self.paths.append (p [3])
+        elif name == 'msg':
+            self.out.write ('%s  Rev %s  %s\n\n' % \
+                            (self.date, self.revision, self.author))
+            text = '%s: %s' % (string.join (self.paths, ', '), self.text)
+            self.out.write ('\t* %s' % linewrap (text))
+        elif name == 'date':
+            self.date = self.text[:10] + ' ' + self.text[11:19]
 
-  def char_data(self, data):
-    self.text += data.encode('ascii','replace')
+    def char_data(self, data):
+        self.text += data.encode('ascii','replace')
 
 # -----------------------------------------------------------------------------
 # Helper function to wrap long lines
@@ -82,63 +82,63 @@
 
 def linewrap (message, maxWidth=69, indent = '\t  '):
 
-  text = ''
+    text = ''
 
-  temptext = string.strip (str (message))
-  temptext = temptext.replace ('\n\n', '\r')
-  temptext = temptext.replace ('\n', ' ')
+    temptext = string.strip (str (message))
+    temptext = temptext.replace ('\n\n', '\r')
+    temptext = temptext.replace ('\n', ' ')
 
-  buff = string.split (temptext, '\r')
+    buff = string.split (temptext, '\r')
 
-  for strings in buff:
-    while len (strings) > maxWidth:
+    for strings in buff:
+        while len (strings) > maxWidth:
 
-      index = string.rfind (strings, ' ', 0, maxWidth)
+            index = string.rfind (strings, ' ', 0, maxWidth)
 
-      if index > 0:
-        line = strings [:index]
-      else:
-        line = strings [:maxWidth]
-        index = maxWidth - 1
+            if index > 0:
+                line = strings [:index]
+            else:
+                line = strings [:maxWidth]
+                index = maxWidth - 1
 
-      if text != '':
-        text += indent
-      text += '%s\n' % line
-      strings = strings [index+1:]
-      strings = strings.strip ()
+            if text != '':
+                text += indent
+            text += '%s\n' % line
+            strings = strings [index+1:]
+            strings = strings.strip ()
 
-    line = strings
-    if text != '':
-      text += indent
-    text += '%s\n' % line
-    first = 0
-  return text
+        line = strings
+        if text != '':
+            text += indent
+        text += '%s\n' % line
+        first = 0
+    return text
 
 # -----------------------------------------------------------------------------
 # Build the ChangeLog file
 # -----------------------------------------------------------------------------
 
 def build ():
-  filename = tempfile.mktemp ('xml')
-  if os.system (SVNCMD + '> %s' % filename):
-    print 'Unable to retrieve svn log'
-    sys.exit (1)
+    filename = tempfile.mktemp ('xml')
+    if os.system (SVNCMD + '> %s' % filename):
+        print 'Unable to retrieve svn log'
+        sys.exit (1)
 
-  inp = open (filename)
-  out = open ('ChangeLog' ,'w')
+    inp = open (filename)
+    out = open ('ChangeLog' ,'w')
 
-  try:
-    Parser (inp, out)
-  except:
     try:
-      inp.close ()
-      out.close ()
-      os.unlink (filename)
+        Parser (inp, out)
     except:
-      pass
-    raise
+        try:
+            inp.close ()
+            out.close ()
+            os.unlink (filename)
+        except:
+            pass
+        raise
 
-  # Clean up input/output files
-  inp.close ()
-  out.close ()
-  os.unlink (filename)
+    # Clean up input/output files
+    inp.close ()
+    out.close ()
+    os.unlink (filename)

Modified: trunk/gnue-common/src/setup/GSetup.py
===================================================================
--- trunk/gnue-common/src/setup/GSetup.py       2007-11-21 14:08:59 UTC (rev 
9825)
+++ trunk/gnue-common/src/setup/GSetup.py       2007-11-22 08:48:49 UTC (rev 
9826)
@@ -40,22 +40,22 @@
 # -----------------------------------------------------------------------------
 
 try:
-  if sys.hexversion < 0x02030000:
-    raise AttributeError
+    if sys.hexversion < 0x02030000:
+        raise AttributeError
 except AttributeError:
-  print "-" * 70
-  print """
-  You are running Python %s.
+    print "-" * 70
+    print """
+    You are running Python %s.
 
-  GNU Enterprise requires at least Python 2.3.
-  If you have a later version installed, you should run setup.py
-  against that version. For example, if you have Python 2.3
-  installed, you may need to run:
+    GNU Enterprise requires at least Python 2.3.
+    If you have a later version installed, you should run setup.py
+    against that version. For example, if you have Python 2.3
+    installed, you may need to run:
 
-       python2.3 setup.py
-""" % string.split(sys.version)[0]
-  print "-" * 70
-  sys.exit (1)
+         python2.3 setup.py
+  """ % string.split(sys.version)[0]
+    print "-" * 70
+    sys.exit (1)
 
 # -----------------------------------------------------------------------------
 # Global GSetup instance
@@ -69,72 +69,72 @@
 
 class sdist (distutils.command.sdist.sdist):
 
-  def run (self):
-    global _setup
+    def run (self):
+        global _setup
 
-    _setup.do_build_files ('sdist')
-    distutils.command.sdist.sdist.run (self)
+        _setup.do_build_files ('sdist')
+        distutils.command.sdist.sdist.run (self)
 
-  def prune_file_list(self):
-    distutils.command.sdist.sdist.prune_file_list(self)
-    self.filelist.exclude_pattern('*.dist_template', anchor=0)
+    def prune_file_list(self):
+        distutils.command.sdist.sdist.prune_file_list(self)
+        self.filelist.exclude_pattern('*.dist_template', anchor=0)
 
-  def make_release_tree (self, base_dir, files):
-    distutils.command.sdist.sdist.make_release_tree (self, base_dir, files)
-    self.process_templates(base_dir)
-    _setup.do_build_svnrev (os.path.join(base_dir, 'src', 'svnrev.py'))
+    def make_release_tree (self, base_dir, files):
+        distutils.command.sdist.sdist.make_release_tree (self, base_dir, files)
+        self.process_templates(base_dir)
+        _setup.do_build_svnrev (os.path.join(base_dir, 'src', 'svnrev.py'))
 
-  def process_templates(self, target):
+    def process_templates(self, target):
 
-    # Build list of files to be processed.
-    filelist = FileList()
-    if filelist.include_pattern('*.dist_template', anchor=0) == 0:
-        # Nothing to do.
-        return
+        # Build list of files to be processed.
+        filelist = FileList()
+        if filelist.include_pattern('*.dist_template', anchor=0) == 0:
+            # Nothing to do.
+            return
 
-    # FIXME: For compatibility with old packages not yet using the version
-    # module. Change to unconditional import in gnue-common 0.8.
-    try:
-        from src import version
-    except:
-        return
+        # FIXME: For compatibility with old packages not yet using the version
+        # module. Change to unconditional import in gnue-common 0.8.
+        try:
+            from src import version
+        except:
+            return
 
-    # List of keywords to replace.
-    keywords = {
-            ':PACKAGE:': self.distribution.get_name(),
-            ':TITLE:': self.distribution.get_description(),
-            ':VERSION:': self.distribution.get_version(),
-            ':MAJOR:': str(version.major),
-            ':MINOR:': str(version.minor),
-            ':PHASE:': str(version.phase),
-            ':BUILD:': str(version.build),
-            ':SVN:': str(version.svn),
-            ':DATE_ISO:': time.strftime('%Y-%m-%d', time.gmtime()),
-            ':DATE_RFC:': time.strftime('%a, %d %b %Y', time.gmtime()),
-            ':TIME:': time.strftime('%H:%M:%S', time.gmtime())}
-    # Hack for version numbering schemes that are limited to x.y.z.
-    if version.phase == 'final':
-        keywords[':FINAL:'] = str(version.build)
-    else:
-        keywords[':FINAL:'] = '0'
+        # List of keywords to replace.
+        keywords = {
+                ':PACKAGE:': self.distribution.get_name(),
+                ':TITLE:': self.distribution.get_description(),
+                ':VERSION:': self.distribution.get_version(),
+                ':MAJOR:': str(version.major),
+                ':MINOR:': str(version.minor),
+                ':PHASE:': str(version.phase),
+                ':BUILD:': str(version.build),
+                ':SVN:': str(version.svn),
+                ':DATE_ISO:': time.strftime('%Y-%m-%d', time.gmtime()),
+                ':DATE_RFC:': time.strftime('%a, %d %b %Y', time.gmtime()),
+                ':TIME:': time.strftime('%H:%M:%S', time.gmtime())}
+        # Hack for version numbering schemes that are limited to x.y.z.
+        if version.phase == 'final':
+            keywords[':FINAL:'] = str(version.build)
+        else:
+            keywords[':FINAL:'] = '0'
 
-    for src in filelist.files:
-        dst = os.path.join(target, src[:-14])
-        args = (src, dst, keywords)
-        self.execute(self.__process_template, args,
-                "generating %s from %s" % (dst, src))
+        for src in filelist.files:
+            dst = os.path.join(target, src[:-14])
+            args = (src, dst, keywords)
+            self.execute(self.__process_template, args,
+                    "generating %s from %s" % (dst, src))
 
-  def __process_template(self, src, dst, keywords):
-    infile = open(src, 'r')
-    content = infile.read()
-    infile.close()
-    for keyword, value in keywords.iteritems():
-        content = content.replace(keyword, value)
-    outfile = open(dst, 'w')
-    outfile.write(content)
-    outfile.close()
-    # Let destination file have the same mode than the source file.
-    os.chmod(dst, os.stat(src).st_mode)
+    def __process_template(self, src, dst, keywords):
+        infile = open(src, 'r')
+        content = infile.read()
+        infile.close()
+        for keyword, value in keywords.iteritems():
+            content = content.replace(keyword, value)
+        outfile = open(dst, 'w')
+        outfile.write(content)
+        outfile.close()
+        # Let destination file have the same mode than the source file.
+        os.chmod(dst, os.stat(src).st_mode)
 
 # =============================================================================
 # build: if done from SVN, build files to be installed first
@@ -142,15 +142,15 @@
 
 class build (distutils.command.build.build):
 
-  def run (self):
-    global _setup
+    def run (self):
+        global _setup
 
-    if not os.path.isfile ("PKG-INFO"):         # downloaded from SVN?
-      _setup.do_build_files ('build')
-    distutils.command.build.build.run (self)
-    if not os.path.isfile ("PKG-INFO"):
-      _setup.do_build_svnrev (os.path.join(self.build_lib, 'gnue',
-            _setup.package[5:].lower(), 'svnrev.py'))
+        if not os.path.isfile ("PKG-INFO"):         # downloaded from SVN?
+            _setup.do_build_files ('build')
+        distutils.command.build.build.run (self)
+        if not os.path.isfile ("PKG-INFO"):
+            _setup.do_build_svnrev (os.path.join(self.build_lib, 'gnue',
+                  _setup.package[5:].lower(), 'svnrev.py'))
 
 # =============================================================================
 # install: Some user_options are no longer allowed
@@ -158,263 +158,271 @@
 
 class install (distutils.command.install.install):
 
-  # Commented out because sometimes, to create packages, we want to install
-  # other tools in a different target directory than common is installed
-  #user_options = distutils.command.install.install.user_options
+    # Commented out because sometimes, to create packages, we want to install
+    # other tools in a different target directory than common is installed
+    #user_options = distutils.command.install.install.user_options
 
-  #allowed_options = ["root=", "compile", "no-compile", "optimize=", "force",
-  #                   "skip-build", "record="]
+    #allowed_options = ["root=", "compile", "no-compile", "optimize=", "force",
+    #                   "skip-build", "record="]
 
-  #user_options = [opt for opt in user_options if opt [0] in allowed_options]
+    #user_options = [opt for opt in user_options if opt [0] in allowed_options]
 
-  user_options = distutils.command.install.install.user_options
-  i = 0
-  for option in user_options:
-    i = i + 1
-    if option [0] == "install-data=":
-      user_options.insert (i, ("install-config=", None,
+    user_options = distutils.command.install.install.user_options
+    i = 0
+    for option in user_options:
+        i = i + 1
+        if option [0] == "install-data=":
+            user_options.insert (i, ("install-config=", None,
                              "installation directory for configuration files"))
-      break
+            break
 
-  # ---------------------------------------------------------------------------
-  # Initalize options
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Initalize options
+    # -------------------------------------------------------------------------
 
-  def initialize_options (self):
-    distutils.command.install.install.initialize_options (self)
-    self.install_config = None
+    def initialize_options (self):
+        distutils.command.install.install.initialize_options (self)
+        self.install_config = None
 
-  # ---------------------------------------------------------------------------
-  # Finalize options - set all install targets
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Finalize options - set all install targets
+    # -------------------------------------------------------------------------
 
-  def finalize_options (self):
+    def finalize_options (self):
 
-    if self.install_lib     is None: self.install_lib     = gnue.paths.lib
-    if self.install_scripts is None: self.install_scripts = gnue.paths.scripts
-    if self.install_data    is None: self.install_data    = gnue.paths.data
-    if self.install_config  is None: self.install_config  = gnue.paths.config
+        if self.install_lib is None:
+            self.install_lib = gnue.paths.lib
+        if self.install_scripts is None:
+            self.install_scripts = gnue.paths.scripts
+        if self.install_data is None:
+            self.install_data = gnue.paths.data
+        if self.install_config is None:
+            self.install_config = gnue.paths.config
 
-    distutils.command.install.install.finalize_options (self)
+        distutils.command.install.install.finalize_options (self)
 
-  # ---------------------------------------------------------------------------
-  # install.run: generate and install path dependent files afterwards
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # install.run: generate and install path dependent files afterwards
+    # -------------------------------------------------------------------------
 
-  def run (self):
-    global _setup
+    def run (self):
+        global _setup
 
-    _setup.check_dependencies ()
+        _setup.check_dependencies ()
 
-    self.__outputs = []
+        self.__outputs = []
 
-    # install translations
-    if os.path.isdir ('po'):
-      # copy files
-      for f in os.listdir ('po'):
-        if f [-4:] == '.gmo':
-          src = os.path.join ('po', f)
-          dst = os.path.join (self.install_data, 'share', 'locale', f [:-4],
-                              'LC_MESSAGES')
-          self.mkpath (dst)
-          dst = os.path.join (dst, _setup.package + '.mo')
-          self.copy_file (src, dst)
-          self.__outputs.append (dst)
+        # install translations
+        if os.path.isdir ('po'):
+            # copy files
+            for f in os.listdir ('po'):
+                if f [-4:] == '.gmo':
+                    src = os.path.join ('po', f)
+                    dst = os.path.join (self.install_data, 'share', 'locale', f
+                            [:-4], 'LC_MESSAGES')
+                    self.mkpath (dst)
+                    dst = os.path.join (dst, _setup.package + '.mo')
+                    self.copy_file (src, dst)
+                    self.__outputs.append (dst)
 
-    distutils.command.install.install.run (self)
+        distutils.command.install.install.run (self)
 
-  # ---------------------------------------------------------------------------
-  # install.get_outputs: list all installed files
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # install.get_outputs: list all installed files
+    # -------------------------------------------------------------------------
 
-  def get_outputs (self):
-    return distutils.command.install.install.get_outputs (self) \
-           + self.__outputs
+    def get_outputs (self):
+        return distutils.command.install.install.get_outputs (self) \
+               + self.__outputs
 
 # =============================================================================
 # GSetup: Basic class for setup scripts of GNUe packages
 # =============================================================================
 
 class GSetup:
-    
-  # ---------------------------------------------------------------------------
-  # Abstract methods: setup.py scripts generally override these
-  # ---------------------------------------------------------------------------
 
-  def set_params (self, params):
-    pass
-  
-  def build_files (self, action):
-    pass
+    # -------------------------------------------------------------------------
+    # Abstract methods: setup.py scripts generally override these
+    # -------------------------------------------------------------------------
 
-  def check_dependencies (self):
-    pass
+    def set_params (self, params):
+        pass
 
-  # ---------------------------------------------------------------------------
-  # Build files if called from SVN
-  # ---------------------------------------------------------------------------
+    def build_files (self, action):
+        pass
 
-  def do_build_files (self, action):
+    def check_dependencies (self):
+        pass
 
-    if os.name == 'posix':
+    # -------------------------------------------------------------------------
+    # Build files if called from SVN
+    # -------------------------------------------------------------------------
 
-      # First check if we have everything installed we need to build the
-      # distribution
+    def do_build_files (self, action):
 
-      if os.path.isdir ('po'):
-        # xgettext
-        if os.system ("pygettext --version > /dev/null") != 0:
-          log.fatal("Could not find 'pygettext'. Strange.")
-          log.fatal("It should be included in the Python distribution.")
-          sys.exit (1)
+        if os.name == 'posix':
 
-        # msgmerge
-        if os.system ("msgmerge --version > /dev/null") != 0:
-          log.fatal("Could not find 'msgmerge'. Please install Gettext.")
-          sys.exit (1)
+            # First check if we have everything installed we need to build the
+            # distribution
 
-        # msgfmt
-        if os.system ("msgfmt --version > /dev/null") != 0:
-          log.fatal("Could not find 'msgfmt'. Please install Gettext.")
-          sys.exit (1)
+            if os.path.isdir ('po'):
+                # xgettext
+                if os.system ("pygettext --version > /dev/null") != 0:
+                    log.fatal("Could not find 'pygettext'. Strange.")
+                    log.fatal("It should be included in the Python " \
+                              "distribution.")
+                    sys.exit (1)
 
-      # -----------------------------------------------------------------------
+                # msgmerge
+                if os.system ("msgmerge --version > /dev/null") != 0:
+                    log.fatal("Could not find 'msgmerge'. Please install " \
+                              "Gettext.")
+                    sys.exit (1)
 
-      if action == 'sdist':
-        # build ChangeLog file
-        log.info("building ChangeLog")
-        ChangeLog.build ()
+                # msgfmt
+                if os.system ("msgfmt --version > /dev/null") != 0:
+                    log.fatal("Could not find 'msgfmt'. Please install " \
+                              "Gettext.")
+                    sys.exit (1)
 
-      # build translations
-      if os.path.isdir ('po'):
-        log.info("building translations")
-        if os.system ("cd po && make gmo") != 0:
-          sys.exit (1)
+            # -----------------------------------------------------------------
 
-    else:
-      # on non posix systems just run msgfmt on existing .po files
-      if os.path.isdir ('po'):
-        # msgfmt.py
-        argv0_path = os.path.dirname(os.path.abspath(sys.executable))
-        sys.path.append(argv0_path + "\\tools\\i18n")
-      
-        msgfmtOK = 0
-        try:
-          import msgfmt
-          msgfmtOK = 1
-        except:
-          pass
-      
-        if msgfmtOK == 1:
-          # pygettext.py exist in Python, but no msgmerge, so
-          # just create a placeholder...
-          potfile = open('po/'+ self.package +'.pot', 'w')
-          potfile.write("#placeholder")
-          potfile.close()
+            if action == 'sdist':
+                # build ChangeLog file
+                log.info("building ChangeLog")
+                ChangeLog.build ()
 
-          # build translations
-          log.info("building translations")
-          for f in os.listdir('po'):
-            if f[-3:] == '.po':
-              msgfmt.make ('po/'+f, 'po/'+f[:-3]+'.gmo')
-              msgfmt.MESSAGES = {}
+            # build translations
+            if os.path.isdir ('po'):
+                log.info("building translations")
+                if os.system ("cd po && make gmo") != 0:
+                    sys.exit (1)
 
+        else:
+            # on non posix systems just run msgfmt on existing .po files
+            if os.path.isdir ('po'):
+                # msgfmt.py
+                argv0_path = os.path.dirname(os.path.abspath(sys.executable))
+                sys.path.append(argv0_path + "\\tools\\i18n")
+
+                msgfmtOK = 0
+                try:
+                    import msgfmt
+                    msgfmtOK = 1
+                except:
+                    pass
+
+                if msgfmtOK == 1:
+                    # pygettext.py exist in Python, but no msgmerge, so
+                    # just create a placeholder...
+                    potfile = open('po/'+ self.package +'.pot', 'w')
+                    potfile.write("#placeholder")
+                    potfile.close()
+
+                    # build translations
+                    log.info("building translations")
+                    for f in os.listdir('po'):
+                        if f[-3:] == '.po':
+                            msgfmt.make ('po/'+f, 'po/'+f[:-3]+'.gmo')
+                            msgfmt.MESSAGES = {}
+
+        # ---------------------------------------------------------------------
+
+        # do package specific stuff
+        self.build_files (action)
+
     # -------------------------------------------------------------------------
+    # Build files if called from SVN
+    # -------------------------------------------------------------------------
 
-    # do package specific stuff
-    self.build_files (action)
+    def do_build_svnrev (self, filename):
 
-  # ---------------------------------------------------------------------------
-  # Build files if called from SVN
-  # ---------------------------------------------------------------------------
+        log.info("building svnrev.py")
+        output = open(filename, 'w')
+        output.write('svnrev = %r' % version.get_svn_revision('src'))
+        output.close()
 
-  def do_build_svnrev (self, filename):
+    # -------------------------------------------------------------------------
+    # Helper methods for descendants
+    # -------------------------------------------------------------------------
 
-      log.info("building svnrev.py")
-      output = open(filename, 'w')
-      output.write('svnrev = %r' % version.get_svn_revision('src'))
-      output.close()
+    def allfiles (self, directory):
+        directory = os.path.normpath (directory)
+        exclude = [".svn", "CVS", "README.cvs", ".cvsignore", "Makefile"]
+        return [directory + "/" + file for file in os.listdir (directory) \
+                if not file in exclude and
+                   not os.path.isdir (os.path.join (directory, file))]
 
-  # ---------------------------------------------------------------------------
-  # Helper methods for descendants
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Get all packages in a directory
+    # -------------------------------------------------------------------------
 
-  def allfiles (self, directory):
-    directory = os.path.normpath (directory)
-    exclude = [".svn", "CVS", "README.cvs", ".cvsignore", "Makefile"]
-    return [directory + "/" + file for file in os.listdir (directory) \
-            if not file in exclude and
-               not os.path.isdir (os.path.join (directory, file))]
+    def __get_packages (self, directory, package):
+        content = os.listdir (directory)
+        result = []
+        if "__init__.py" in content:
+            result = [package]
+            for name in content:
+                fullname = os.path.join (directory, name)
+                if os.path.isdir (fullname):
+                    result = result + self.__get_packages (fullname, package +
+                            "." + name)
+        return result
 
-  # ---------------------------------------------------------------------------
-  # Get all packages in a directory
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Call the actual setup routine
+    # -------------------------------------------------------------------------
 
-  def __get_packages (self, directory, package):
-    content = os.listdir (directory)
-    result = []
-    if "__init__.py" in content:
-      result = [package]
-      for name in content:
-        fullname = os.path.join (directory, name)
-        if os.path.isdir (fullname):
-          result = result + self.__get_packages (fullname, package + "." + 
name)
-    return result
+    def run (self):
+        global _setup
 
-  # ---------------------------------------------------------------------------
-  # Call the actual setup routine
-  # ---------------------------------------------------------------------------
+        # set global variable
+        _setup = self
 
-  def run (self):
-    global _setup
+        setup_params = {"cmdclass_sdist": sdist,
+                        "cmdclass_build": build,
+                        "cmdclass_install": install,
+                       }
 
-    # set global variable
-    _setup = self
+        _setup.set_params (setup_params)
 
-    setup_params = {"cmdclass_sdist": sdist,
-                    "cmdclass_build": build,
-                    "cmdclass_install": install,
-                   }
+        # make package available
+        self.package = setup_params ["name"]
 
-    _setup.set_params (setup_params)
 
-    # make package available
-    self.package = setup_params ["name"]
-    
+        # find out all packages
+        if not setup_params.has_key ("packages"):
+            packages = []
+            for module, directory in setup_params["package_dir"].items ():
+                packages = packages + self.__get_packages (directory, module)
+            setup_params ["packages"] = packages
 
-    # find out all packages
-    if not setup_params.has_key ("packages"):
-      packages = []
-      for module, directory in setup_params["package_dir"].items ():
-        packages = packages + self.__get_packages (directory, module)
-      setup_params ["packages"] = packages
+        # remove data files that are not available
+        for target, files in setup_params ["data_files"]:
+            i = 0
+            while i < len (files):
+                file = files [i]
+                if os.path.isfile (file):
+                    i += 1
+                else:
+                    log.warn("warning: did not find file %s" % file)
+                    files.remove (file)
 
-    # remove data files that are not available
-    for target, files in setup_params ["data_files"]:
-      i = 0
-      while i < len (files):
-        file = files [i]
-        if os.path.isfile (file):
-          i += 1
-        else:
-          log.warn("warning: did not find file %s" % file)
-          files.remove (file)
+        # now call setup
+        setup (name             = setup_params ["name"],
+               version          = setup_params ["version"],
+               description      = setup_params ["description"],
+               long_description = setup_params ["long_description"],
+               author           = setup_params ["author"],
+               author_email     = setup_params ["author_email"],
+               url              = setup_params ["url"],
+               license          = setup_params ["license"],
+               packages         = setup_params ["packages"],
+               package_dir      = setup_params ["package_dir"],
+               scripts          = setup_params ["scripts"],
+               data_files       = setup_params ["data_files"],
 
-    # now call setup
-    setup (name             = setup_params ["name"],
-           version          = setup_params ["version"],
-           description      = setup_params ["description"],
-           long_description = setup_params ["long_description"],
-           author           = setup_params ["author"],
-           author_email     = setup_params ["author_email"],
-           url              = setup_params ["url"],
-           license          = setup_params ["license"],
-           packages         = setup_params ["packages"],
-           package_dir      = setup_params ["package_dir"],
-           scripts          = setup_params ["scripts"],
-           data_files       = setup_params ["data_files"],
-
-           # Override certain command classes with our own ones
-           cmdclass = {"sdist":   setup_params["cmdclass_sdist"],
-                       "build":   setup_params["cmdclass_build"],
-                       "install": setup_params["cmdclass_install"]})
+               # Override certain command classes with our own ones
+               cmdclass = {"sdist":   setup_params["cmdclass_sdist"],
+                           "build":   setup_params["cmdclass_build"],
+                           "install": setup_params["cmdclass_install"]})





reply via email to

[Prev in Thread] Current Thread [Next in Thread]