import sys
import os

def main(package_name, version):

    pdir = 'central/{}'.format(package_name)

    os.system('rm -rf build')
    build_dir = 'build'.format(package_name, version)
    package_dir = 'build/{}/{}'.format(package_name, version)
    lib_dir = '{}/lib'.format(build_dir)
    os.system('mkdir -p {}'.format(package_dir))
    os.system('mkdir -p {}'.format(lib_dir))

    for filename in os.listdir(pdir):
        if '.me' in filename:
            origin = os.path.join(pdir, filename)
            dest = os.path.join(package_dir, filename)
            os.system('cp {} {}'.format(origin, dest))
        elif '.so' in filename:
            origin = os.path.join(pdir, filename)
            dest = os.path.join(build_dir, 'lib', filename)
            os.system('cp {} {}'.format(origin, dest))
        elif '.img' in filename:
            origin = os.path.join(pdir, filename)
            scp = 'scp {} thiago@memetalk.org:/var/www/modules/central/{}/{}'.format(origin, package_name, 'core-{}.img'.format(version))
            print scp
            os.system(scp)

    tar_name = '{}-{}.tar.gz'.format(package_name, version)
    os.system('tar cvfz {} {} {}'.format(tar_name, package_dir, lib_dir))
    scp = 'scp {} publish@memetalk.org:/var/www/modules/central/{}/{}'.format(tar_name, package_name, tar_name)
    print scp
    os.system(scp)

main(sys.argv[1], sys.argv[2])

@@ -103,87 +103,73 @@
     
-os.system('rm -rf build')%0A    build_dir = 'build'.format(package_name, version)
+build_dir = 'build'%0A    os.system('rm -rf %7B%7D'.format(build_dir))%0A
 %0A   
@@ -190,16 +190,22 @@
  'build/
+cache/
 %7B%7D/%7B%7D'.f
@@ -423,16 +423,56 @@
 if '.me'
+ in filename or '.g' in filename or '.k'
  in file
@@ -947,14 +947,15 @@
  %7B%7D 
-thiago
+publish
 @mem
@@ -1181,16 +1181,23 @@
 system('
+cd %7B%7D; 
 tar cvfz
@@ -1204,52 +1204,45 @@
  %7B%7D 
-%7B%7D %7B%7D'.format(tar_name, package_dir, lib_dir
+cache lib'.format(build_dir, tar_name
 ))%0A 
@@ -1243,32 +1243,39 @@
 me))%0A    scp = '
+cd %7B%7D; 
 scp %7B%7D publish@m
@@ -1325,16 +1325,27 @@
 .format(
+build_dir, 
 tar_name
@@ -1384,24 +1384,30 @@
 int scp%0A    
+print 
 os.system(sc

Update publish.py