예제 #1
0
    def build(self):
        realpath = os.path.join(Artifact.home_dir(), self.path)

        if not os.path.exists(realpath):
            raise IOError("Path '%s' link has to refer does not exist." % self.path)

        os.chdir(Artifact.home_dir())
        if os.path.exists(self.name):
            os.unlink(self.name)
            
        os.symlink(realpath, self.name)    
예제 #2
0
 def cleanup(self):
     path = self.fullpath()
     if os.path.exists(path):
         if os.path.isdir(path) : 
             os.chdir(Artifact.home_dir())
             shutil.rmtree(self.name)
         else: 
             raise IOError()
예제 #3
0
 def build(self):    
     self.cleanup_log()
     config_path = self.fullpath()
     source_conf = ConfigParser.ConfigParser({'home_dir':Artifact.home_dir()})     
     source_conf.read([config_path])
                     
     for conf_file in self.generator():
         self.configure(source_conf, conf_file)            
예제 #4
0
    def build(self):
        self.cleanup_log()
        config_path = self.fullpath()
        source_conf = ConfigParser.ConfigParser(
            {'home_dir': Artifact.home_dir()})
        source_conf.read([config_path])

        for conf_file in self.generator():
            self.configure(source_conf, conf_file)
예제 #5
0
def load_mysql_parameters(obj, config_path, section='DEFAULT'):
    if not os.path.isabs(config_path):
        config_path = os.path.join(Artifact.home_dir(), config_path)

    if not os.path.exists(config_path):
        raise IOError("Configuration file '%s' cannot be found." % config_path)
    c = ConfigParser.ConfigParser()
    c.read([config_path])
    obj.username = c.get(section, 'user')
    obj.password = c.get(section, 'passwd')
    obj.hostname = c.get(section, 'host')
    obj.dbname = c.get(section, 'db')
예제 #6
0
    def build(self):
        self.destination.build()
        zippath     = self.fullpath()
        destination = self.destination.fullpath()

        tmp  = tempfile.mkstemp(dir=Artifact.home_dir())
        null = open(tmp[1], "w")
        try: 
            ShellScriptHelper.run('unzip', " %s -d %s " % (zippath, destination), False, null)   
        finally: 
            null.close()
            os.remove(tmp[1])
예제 #7
0
def load_mysql_parameters(obj, config_path, section = 'DEFAULT'):   
    if not os.path.isabs(config_path):
        config_path = os.path.join(Artifact.home_dir(), config_path)
   
    if not os.path.exists(config_path) : 
        raise IOError("Configuration file '%s' cannot be found." % config_path)
    c = ConfigParser.ConfigParser()
    c.read([config_path])
    obj.username = c.get(section, 'user') 
    obj.password = c.get(section, 'passwd')
    obj.hostname = c.get(section, 'host')
    obj.dbname   = c.get(section, 'db')
예제 #8
0
 def class_path(self):
     classpath = []
     for path in self.classpath:
         path = os.path.join(Artifact.home_dir(), path)
         
         if not os.path.exists(path):
             raise BaseException("Invalid classpath item '%s'" % path)
         
         if os.path.isdir(path):
             for jar in self.collect_jars(path):
                 classpath.append(jar)
         else: 
             classpath.append(path)
     
     return ":".join(classpath)
예제 #9
0
    def build(self):
        super(DownloadArchivedFiles, self).build()

        tmp = tempfile.mkstemp(dir=Artifact.home_dir())
        try:
            RemoteFile(os.path.basename(tmp[1]), self.url).build()
            if self.use_shell_unzip: self.shell_unzip(os.path.basename(tmp[1]))
            else: self.py_unzip(tmp[1])
        finally:
            os.remove(tmp[1])

        if self.do_if_absent != None:
            p = os.path.join(self.fullpath(), self.do_if_absent)
            if not os.path.exists(p):
                raise BaseException("File '%s' cannot be found after unzip" %
                                    p)
예제 #10
0
    def build(self):
        super(DownloadArchivedFiles, self).build()

        tmp = tempfile.mkstemp(dir=Artifact.home_dir())
        try:
            RemoteFile(os.path.basename(tmp[1]), self.url).build()
            if self.use_shell_unzip:
                self.shell_unzip(os.path.basename(tmp[1]))
            else:
                self.py_unzip(tmp[1])
        finally:
            os.remove(tmp[1])

        if self.do_if_absent != None:
            p = os.path.join(self.fullpath(), self.do_if_absent)
            if not os.path.exists(p):
                raise BaseException("File '%s' cannot be found after unzip" % p)
예제 #11
0
    def build(self):
        path = self.fullpath()
        if os.path.isdir(path):
            path = os.path.join(path, "setup.py")
            if not os.path.exists(path):
                raise BaseException("Setup file '%s' doesn't exist." % path)

        pkg_folder = os.path.dirname(path)
        lib_root = os.path.join(Artifact.home_dir(), self.lib)
        if not os.path.exists(lib_root) or not os.path.isdir(lib_root):
            raise BaseException("Lib folder '%s' doesn't exist." % path)

        os.chdir(pkg_folder)

        cmd = "python %s -q " % os.path.basename(path)
        ShellScriptHelper.run(cmd + " build  --build-lib %s" % lib_root)
        ShellScriptHelper.run(cmd + " install --install-lib %s  --install-headers %s" % (lib_root, lib_root))

        shutil.rmtree(os.path.join(pkg_folder, "build"))
예제 #12
0
    def build(self):
        path = self.fullpath()
        if os.path.isdir(path):
            path = os.path.join(path, "setup.py")
            if not os.path.exists(path):
                raise BaseException("Setup file '%s' doesn't exist." % path)

        pkg_folder = os.path.dirname(path)
        lib_root = os.path.join(Artifact.home_dir(), self.lib)
        if not os.path.exists(lib_root) or not os.path.isdir(lib_root):
            raise BaseException("Lib folder '%s' doesn't exist." % path)

        os.chdir(pkg_folder)

        cmd = "python %s -q " % os.path.basename(path)
        ShellScriptHelper.run(cmd + " build  --build-lib %s" % lib_root)
        ShellScriptHelper.run(
            cmd + " install --install-lib %s  --install-headers %s" %
            (lib_root, lib_root))

        shutil.rmtree(os.path.join(pkg_folder, "build"))
예제 #13
0
 def __init__(self, name, url, dependencies=[]):
     p = os.path.join(Artifact.home_dir(), name)
     if os.path.isdir(p): name = os.path.join(name, url.split('/')[-1])
     RemoteFile.__init__(self, name, url, dependencies)
예제 #14
0
 def __init__(self, name, url, dependencies=[]):
     p = os.path.join(Artifact.home_dir(), name)
     if os.path.isdir(p):
         name = os.path.join(name, url.split("/")[-1])
     RemoteFile.__init__(self, name, url, dependencies)
예제 #15
0
파일: __init__.py 프로젝트: barmalei/primus

__all__ = ['artifactcore', 'fileartifact', 'pyartifact', 'repartifact', 'mysqlartifact', 'confartifact', 'javaartifact']
from artifactcore import Artifact
print "\n:: Primus - deployment tool"
print ":: v1.4.1, Apr 2012"
print ":: target project home: '%s'\n" % (Artifact.home_dir()) 
예제 #16
0
    def fullpath(self): return os.path.join(Artifact.home_dir(), self.name)


class AcquiredFile(FileArtifact):
예제 #17
0
__all__ = [
    'artifactcore', 'fileartifact', 'pyartifact', 'repartifact',
    'mysqlartifact', 'confartifact', 'javaartifact'
]
from artifactcore import Artifact
print "\n:: Primus - deployment tool"
print ":: v1.4.1, Apr 2012"
print ":: target project home: '%s'\n" % (Artifact.home_dir())
예제 #18
0
 def generator(self): 
     for conf in self.target:
         conf = os.path.join(Artifact.home_dir(), conf)
         yield conf
예제 #19
0
 def generator(self):
     for conf in self.target:
         conf = os.path.join(Artifact.home_dir(), conf)
         yield conf