コード例 #1
0
    inchar = '\t'
    outchar = ' '
    inmultiplier = 1
    outmultiplier = 4

# Set indentation properties from spaces to tabs.
if options.totabs:
    inchar = ' '
    outchar = '\t'
    inmultiplier = 4
    outmultiplier = 1

# If a folder target is given find files path,
# else the given file is the unique path.
if os.path.isdir(target):
    pypaths = sh('find %s -name "*.py"' % target)
    cypaths = sh('find %s -name "*.cy"' % target)
    pypaths = pypaths.split('\n')
    cypaths = cypaths.split('\n')
    paths = pypaths + cypaths
else:
    paths = [target]

# Iterate over paths.
for path in paths:

    # Retrieve file data.
    handler = open(path)
    data = handler.read()

    # Check indent type.
コード例 #2
0
import os
import shutil
import re
import ConfigParser
from commands import getoutput as sh

import docgen


# Relative paths for code and documentation bases.
code = '.'
docs = 'doc/source'

# Find and remove old documentation files.
rstfiles = sh('find %s -name *.rst -type f' % docs)
rstfiles = rstfiles.split('\n')
rstfiles = [x for x in rstfiles if '__init__.rst' not in x]
rstfiles = [x for x in rstfiles if 'index.rst' not in x]
for rstfile in rstfiles: os.remove(rstfile)

# List target folders
folders = [
    'nathive/lib',
    'nathive/gui',
    'utils/dotcy',
    'utils/docgen']

# Generate documentation.
for folder in folders:
    infolder = os.path.join(code, folder)