00001 __copyright__ = """ 00002 Copyright 2008 Sean Ross-Ross 00003 """ 00004 __license__ = """ 00005 This file is part of SLIMpy. 00006 00007 SLIMpy is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU Lesser General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 SLIMpy is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public License 00018 along with SLIMpy. If not, see <http://www.gnu.org/licenses/>. 00019 """ 00020 00021 from os import walk,system,curdir 00022 from os.path import dirname,join,abspath 00023 import SLIMpy 00024 00025 from os import environ 00026 00027 slfile = dirname(SLIMpy.__file__) 00028 w = walk( slfile ) 00029 fpath = "/".join(slfile.split("/")[:-1])+"/" 00030 00031 PYTHONPATH = environ.get("PYTHONPATH","") 00032 00033 pydoc = WhereIs('pydoc') 00034 def helper(): 00035 00036 for dir , nextdirs , files in w: 00037 if ".svn" not in dir and 'test' not in dir and 'Plugin' not in dir and 'doc' not in dir: 00038 00039 imp = dir.replace(fpath, "") 00040 ldir = imp.split('/') 00041 00042 #yield ".".join(ldir) 00043 00044 for f in files: 00045 if f.endswith(".py"): 00046 file = join(dir,f) 00047 00048 if f == "__init__.py": 00049 imp = ".".join(ldir) 00050 html = ".".join(ldir+["html"]) 00051 else: 00052 imp = ".".join(ldir+[f[:-3]]) 00053 html = ".".join(ldir+[f[:-3] + ".html"]) 00054 yield file ,html, imp 00055 00056 env = Environment(ENV = dict(PATH = environ['PATH'],PYTHONPATH = environ["PYTHONPATH"] , RSFROOT = environ["RSFROOT"] ) ) 00057 00058 subdir = abspath(curdir) 00059 topdir = abspath(str(env.Dir('#'))) 00060 00061 00062 result = [] 00063 installs = [] 00064 for file ,html,imp in helper(): 00065 if subdir == topdir: 00066 html = env.Command( html,file , "%(pydoc)s -w %(imp)s" %vars() ) 00067 else: 00068 html = env.Command( html,file , "cd %(subdir)s;\n%(pydoc)s -w %(imp)s;\n cd %(topdir)s;" %vars() ) 00069 result.append(html) 00070 00071 i = env.Install('../html/autodoc',html ) 00072 installs.append(i) 00073 00074 Alias('install', installs ) 00075 #env.Alias( result, 'auto' ) 00076 #env.Alias( result, 'html' ) 00077 00078 00079 00080