Exemplo n.º 1
0
#       * Redistributions of source code must retain the above copyright
#         notice, this list of conditions and the following disclaimer.
#       * Redistributions in binary form must reproduce the above
#         copyright notice, this list of conditions and the following disclaimer
#         in the documentation and/or other materials provided with the
#         distribution.
#       * Neither the name of the  nor the names of its
#         contributors may be used to endorse or promote products derived from
#         this software without specific prior written permission.
#       
#       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
#       "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
#       LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
#       A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
#       OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#       SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
#       LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
#       DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
#       THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
#       (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
#       OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

if __name__ == "__main__":
    import os, mylib, re
    for fn in  mylib.listDir("../"):
        if re.search("\.pyc$", fn):
            try :
                os.remove(fn)
            except :
                pass
Exemplo n.º 2
0
#-*-coding:utf-8-*-
#Generator module's names to mods.py > mods=[<moduleNameList>]
#Don't live load this module if we don't have anyway faster than it.
import os, sys, re
import mylib
mods=[]
for path in sys.path :
    try:
        if os.path.isdir(path):
            mods.extend(mylib.listDir(path, False))
    except Exception,e:
            print path
            print e
            print "<-for1\n--------\n"
            
z=[]
fileType="\.py$|\.pyc$|\.pyo$|\.pyd$"

for i in range(0,len(mods)):
    if re.compile(fileType).search(mods[i]) :
        mods[i]=re.sub(fileType,"",mods[i])
        if not mods[i] in z :
            z.append(mods[i])
            
z.extend("sys,os.path".split(","))
z.sort()

dummy="','"
open("modlist.py","w").write("mods=['"+dummy.join(z)+"']")