Back to index

moin  1.9.0~rc2
Classes | Functions | Variables
setup Namespace Reference

Classes

class  build_scripts_create
 Build script files. More...
class  build_scripts_moin

Functions

def isbad
 Helpers.
def isgood
def makeDataFiles
def visit
def make_filelist
def scriptname

Variables

list moin_scripts = [scriptname(fn) for fn in glob.glob('MoinMoin/script/[!_]*.py')]
dictionary setup_args
 Call setup()

Function Documentation

def setup.isbad (   name)

Helpers.

Whether name should not be installed 

Definition at line 24 of file setup.py.

00024 
00025 def isbad(name):
00026     """ Whether name should not be installed """
00027     return (name.startswith('.') or
00028             name.startswith('#') or
00029             name.endswith('.pickle') or
00030             name == 'CVS')

Here is the caller graph for this function:

def setup.isgood (   name)
Whether name should be installed 

Definition at line 31 of file setup.py.

00031 
00032 def isgood(name):
00033     """ Whether name should be installed """
00034     return not isbad(name)

Here is the call graph for this function:

Here is the caller graph for this function:

def setup.make_filelist (   dir,
  strip_prefix = '' 
)
package_data is pretty stupid: if the globs that can be given there
    match a directory, then setup.py install will fall over that later,
    because it expects only files.
    Use make_filelist(dir, strip) to create a list of all FILES below dir,
    stripping off the strip_prefix at the left side.

Definition at line 91 of file setup.py.

00091 
00092 def make_filelist(dir, strip_prefix=''):
00093     """ package_data is pretty stupid: if the globs that can be given there
00094         match a directory, then setup.py install will fall over that later,
00095         because it expects only files.
00096         Use make_filelist(dir, strip) to create a list of all FILES below dir,
00097         stripping off the strip_prefix at the left side.
00098     """
00099     found = []
00100     def _visit((found, strip), dirname, names):
00101         files = []
00102         for name in names:
00103             path = os.path.join(dirname, name)
00104             if os.path.isfile(path):
00105                 if path.startswith(strip):
00106                     path = path[len(strip):]
00107                 files.append(path)
00108         found.extend(files)
00109 
00110     os.path.walk(dir, _visit, (found, strip_prefix))
00111     return found

def setup.makeDataFiles (   prefix,
  dir 
)
Create distutils data_files structure from dir

distutil will copy all file rooted under dir into prefix, excluding
dir itself, just like 'ditto src dst' works, and unlike 'cp -r src
dst, which copy src into dst'.

Typical usage:
    # install the contents of 'wiki' under sys.prefix+'share/moin'
    data_files = makeDataFiles('share/moin', 'wiki')

For this directory structure:
    root
        file1
        file2
        dir
            file
            subdir
                file

makeDataFiles('prefix', 'root')  will create this distutil data_files structure:
    [('prefix', ['file1', 'file2']),
     ('prefix/dir', ['file']),
     ('prefix/dir/subdir', ['file'])]

Definition at line 35 of file setup.py.

00035 
00036 def makeDataFiles(prefix, dir):
00037     """ Create distutils data_files structure from dir
00038 
00039     distutil will copy all file rooted under dir into prefix, excluding
00040     dir itself, just like 'ditto src dst' works, and unlike 'cp -r src
00041     dst, which copy src into dst'.
00042 
00043     Typical usage:
00044         # install the contents of 'wiki' under sys.prefix+'share/moin'
00045         data_files = makeDataFiles('share/moin', 'wiki')
00046 
00047     For this directory structure:
00048         root
00049             file1
00050             file2
00051             dir
00052                 file
00053                 subdir
00054                     file
00055 
00056     makeDataFiles('prefix', 'root')  will create this distutil data_files structure:
00057         [('prefix', ['file1', 'file2']),
00058          ('prefix/dir', ['file']),
00059          ('prefix/dir/subdir', ['file'])]
00060 
00061     """
00062     # Strip 'dir/' from of path before joining with prefix
00063     dir = dir.rstrip('/')
00064     strip = len(dir) + 1
00065     found = []
00066     os.path.walk(dir, visit, (prefix, strip, found))
00067     return found

def setup.scriptname (   path)
Helper for building a list of script names from a list of
    module files.

Definition at line 188 of file setup.py.

00188 
00189 def scriptname(path):
00190     """ Helper for building a list of script names from a list of
00191         module files.
00192     """
00193     script = os.path.splitext(os.path.basename(path))[0]
00194     script = script.replace('_', '-')
00195     if sys.platform == "win32":
00196         script = script + ".bat"
00197     return script
00198 
# build list of scripts from their implementation modules
def setup.visit (   prefix,
  strip,
  found,
  dirname,
  names 
)
Visit directory, create distutil tuple

Add distutil tuple for each directory using this format:
    (destination, [dirname/file1, dirname/file2, ...])

distutil will copy later file1, file2, ... info destination.

Definition at line 68 of file setup.py.

00068 
00069 def visit((prefix, strip, found), dirname, names):
00070     """ Visit directory, create distutil tuple
00071 
00072     Add distutil tuple for each directory using this format:
00073         (destination, [dirname/file1, dirname/file2, ...])
00074 
00075     distutil will copy later file1, file2, ... info destination.
00076     """
00077     files = []
00078     # Iterate over a copy of names, modify names
00079     for name in names[:]:
00080         path = os.path.join(dirname, name)
00081         # Ignore directories -  we will visit later
00082         if os.path.isdir(path):
00083             # Remove directories we don't want to visit later
00084             if isbad(name):
00085                 names.remove(name)
00086             continue
00087         elif isgood(name):
00088             files.append(path)
00089     destination = os.path.join(prefix, dirname[strip:])
00090     found.append((destination, files))

Here is the call graph for this function:


Variable Documentation

list setup.moin_scripts = [scriptname(fn) for fn in glob.glob('MoinMoin/script/[!_]*.py')]

Definition at line 199 of file setup.py.

dictionary setup.setup_args

Call setup()

Definition at line 206 of file setup.py.