pyobjc / setup-lib /

import os
import subprocess
from distutils.dep_util import newer
from distutils.cmd import Command

def rest2HTML(irrelevant, dirName, names):
    while '.svn' in names:
    for aName in names:
        if aName.endswith('.txt'):
            anInputPath = os.path.join(dirName, aName)
            if irrelevant is not None and anInputPath in irrelevant:
            anOutputPath = anInputPath[:-4] + '.html'
            if not newer(anInputPath, anOutputPath):
                print '- %s (skipped: up to date)' % (anInputPath,)
            print '- %s'%(anInputPath)
            outfile = file(anOutputPath, 'w')
            ret =[TOOL, anInputPath], stdout=outfile)
            if ret:

def _iter_paths():
        import DocArticle
    except ImportError:
    yield os.path.dirname(os.path.dirname(DocArticle.__file__))
    for path in os.environ.get('PATH', '/usr/bin:/usr/local/bin').split(':'):
        yield path

for path in _iter_paths():
    TOOL = os.path.join(path, '')
    if os.path.exists(TOOL):
    TOOL = None

class build_html(Command):
    description = "Generate HTML from ReST documentation"
    user_options = []

    def initialize_options(self):
        self.finalized = False

    def finalize_options(self):
        self.finalized = True

    def run(self):
        if TOOL is None:
            print "*** Can't generate HTML, docutils is not installed"
        os.path.walk('Doc', rest2HTML, ['Doc/announcement.txt'])
        rest2HTML(None, '.', [
            'NEWS.txt', 'Install.txt', 'ReadMe.txt', 'Examples/00ReadMe.txt',
            'Installer Package/10.2/ReadMe.txt',
            'Installer Package/10.3/ReadMe.txt',
            'Installer Package/10.4/ReadMe.txt',
            'Xcode/Project Templates/00README.txt',
        if os.path.exists('Xcode/Project Templates/00README.html'):
                os.rename('Xcode/Project Templates/00README.html', 'Doc/Xcode-Templates.html')

cmdclass = dict(build_html=build_html)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.