コード例 #1
0
ファイル: engine.py プロジェクト: yext/icbm
    def Run(self, engine):
        # Always run the precompilation for now
        def _CopyPlayApp(src):
            for dir in ("app", "conf", "public"):
                for root, dirs, files in os.walk(os.path.join(src, dir)):
                    dest_dir = os.path.join(self.prefix, root)
                    if not os.path.exists(dest_dir):
                        os.makedirs(dest_dir)
                    for file in files:
                        dest = os.path.join(dest_dir, file)
                        if not os.path.exists(dest):
                            symlink.symlink(
                                os.path.realpath(os.path.join(root, file)),
                                dest)

        # Copy over the play modules
        for module in self.modules:
            _CopyPlayApp(module)

        # Execute the play compiler
        generate = subprocess.Popen([
            self.play_home + '/play', 'precompile',
            os.path.join(self.prefix, self.modules[0])
        ],
                                    bufsize=1,
                                    close_fds=True,
                                    shell=False)

        if generate.wait() != 0:
            return False

        # Copy all the data file as well
        for data, filename in self.data.iteritems():
            srcprefix = os.path.join(self.prefix, "src")
            path = os.path.join(srcprefix, os.path.dirname(data))
            if not os.path.exists(path):
                os.makedirs(path)
            dest = os.path.join(path, os.path.basename(data))
            if os.path.exists(dest):
                os.unlink(dest)
            symlink.symlink(engine.GetFilename(filename), dest)

        # Zip up the compiled play application
        tmp = os.path.join(self.prefix, ".%s" % self.name)
        f = zipfile.ZipFile(tmp, "w")
        for root, dirs, files in os.walk(self.prefix):
            for name in files:
                path = os.path.join(root, name)
                f.write(path, os.path.relpath(path, self.prefix))
        f.close()

        os.rename(tmp, os.path.join(BUILD_DIR, self.name))

        return True
コード例 #2
0
ファイル: engine.py プロジェクト: Jovena/icbm
    def Run(self, engine):
        # Always run the precompilation for now
        def _CopyPlayApp(src):
            for dir in ("app", "conf", "public"):
                for root, dirs, files in os.walk(os.path.join(src, dir)):
                    dest_dir = os.path.join(self.prefix, root)
                    if not os.path.exists(dest_dir):
                        os.makedirs(dest_dir)
                    for file in files:
                        dest = os.path.join(dest_dir, file)
                        if not os.path.exists(dest):
                            symlink.symlink(
                                os.path.realpath(os.path.join(root, file)),
                                dest)

        # Copy over the play modules
        for module in self.modules:
            _CopyPlayApp(module)

        # Execute the play compiler
        generate = subprocess.Popen(
            [self.play_home + '/play',
             'precompile',
             os.path.join(self.prefix, self.modules[0])],
            bufsize=1,
            close_fds=True,
            shell=False)

        if generate.wait() != 0:
            return False

        # Copy all the data file as well
        for data, filename in self.data.iteritems():
            srcprefix = os.path.join(self.prefix, "src")
            path = os.path.join(srcprefix, os.path.dirname(data))
            if not os.path.exists(path):
                os.makedirs(path)
            dest = os.path.join(path, os.path.basename(data))
            if os.path.exists(dest):
                os.unlink(dest)
            symlink.symlink(engine.GetFilename(filename), dest)

        # Zip up the compiled play application
        tmp = os.path.join(self.prefix, ".%s" % self.name)
        f = zipfile.ZipFile(tmp, "w")
        for root, dirs, files in os.walk(self.prefix):
            for name in files:
                path = os.path.join(root, name)
                f.write(path, os.path.relpath(path, self.prefix))
        f.close()

        os.rename(tmp, os.path.join(BUILD_DIR, self.name))

        return True
コード例 #3
0
ファイル: engine.py プロジェクト: yext/icbm
 def _CopyPlayApp(src):
     for dir in ("app", "conf", "public"):
         for root, dirs, files in os.walk(os.path.join(src, dir)):
             dest_dir = os.path.join(self.prefix, root)
             if not os.path.exists(dest_dir):
                 os.makedirs(dest_dir)
             for file in files:
                 dest = os.path.join(dest_dir, file)
                 if not os.path.exists(dest):
                     symlink.symlink(
                         os.path.realpath(os.path.join(root, file)),
                         dest)
コード例 #4
0
ファイル: engine.py プロジェクト: Jovena/icbm
 def _CopyPlayApp(src):
     for dir in ("app", "conf", "public"):
         for root, dirs, files in os.walk(os.path.join(src, dir)):
             dest_dir = os.path.join(self.prefix, root)
             if not os.path.exists(dest_dir):
                 os.makedirs(dest_dir)
             for file in files:
                 dest = os.path.join(dest_dir, file)
                 if not os.path.exists(dest):
                     symlink.symlink(
                         os.path.realpath(os.path.join(root, file)),
                         dest)
コード例 #5
0
ファイル: engine.py プロジェクト: yext/icbm
    def Setup(self, engine):
        # Make the directory, set up symlinks
        prefix = self.prefix = os.path.join(BUILD_DIR, self.name)
        if not os.path.exists(self.prefix):
            os.makedirs(self.prefix)

        for fake, real in self.sources:
            path = os.path.join(prefix, os.path.dirname(fake))
            if not os.path.exists(path):
                os.makedirs(path)
            dest = os.path.join(path, os.path.basename(fake))
            if not os.path.exists(dest):
                symlink.symlink(engine.GetFilename(real), dest)

        for out in self.outputs:
            path = os.path.join(prefix, os.path.dirname(out))
            if not os.path.exists(path):
                os.makedirs(path)
コード例 #6
0
ファイル: engine.py プロジェクト: Jovena/icbm
    def Setup(self, engine):
        # Make the directory, set up symlinks
        prefix = self.prefix = os.path.join(BUILD_DIR, self.name)
        if not os.path.exists(self.prefix):
            os.makedirs(self.prefix)

        for fake, real in self.sources:
            path = os.path.join(prefix, os.path.dirname(fake))
            if not os.path.exists(path):
                os.makedirs(path)
            dest = os.path.join(path, os.path.basename(fake))
            if not os.path.exists(dest):
                symlink.symlink(engine.GetFilename(real), dest)

        for out in self.outputs:
            path = os.path.join(prefix, os.path.dirname(out))
            if not os.path.exists(path):
                os.makedirs(path)
コード例 #7
0
ファイル: engine.py プロジェクト: yext/icbm
    def Setup(self, engine):
        # Create the prefix where we're going to build everything
        prefix = self.prefix = os.path.join(BUILD_DIR, self.name)
        if not os.path.exists(prefix):
            os.makedirs(prefix)

        # Link in the compile.xml which will tell ant to build things
        compile_xml = os.path.join(prefix, "compile.xml")
        if not os.path.exists(compile_xml):
            symlink.symlink(os.path.join(ICBM_PATH, "compile.xml"),
                            compile_xml)

        # Set up the src/ directory, by symlinking in all the
        # depending source files.
        srcprefix = self.srcprefix = os.path.join(prefix, "src")
        if os.path.exists(srcprefix):
            shutil.rmtree(srcprefix)
        os.makedirs(srcprefix)
        for source, filename in self.sources.iteritems():
            path = os.path.join(srcprefix, os.path.dirname(source))
            if not os.path.exists(path):
                os.makedirs(path)
            dest = os.path.join(path, os.path.basename(source))
            symlink.symlink(engine.GetFilename(filename), dest)

        # Set up the jars/ directory by symlinking in all the depending jars.
        jarprefix = self.jarprefix = os.path.join(prefix, "jars")
        if os.path.exists(jarprefix):
            shutil.rmtree(jarprefix)
        os.makedirs(jarprefix)
        for jar, filename in self.jars.iteritems():
            symlink.symlink(engine.GetFilename(filename),
                            os.path.join(jarprefix, os.path.basename(jar)))

        # Set up the output directory where all the class files will go
        outprefix = self.outprefix = os.path.join(prefix, "classes")
        if not os.path.exists(outprefix):
            os.makedirs(outprefix)

        # Data files are meant to be on the classpath, so put them
        # into classes as well.
        for data, filename in self.data.iteritems():
            path = os.path.join(outprefix, os.path.dirname(data))
            if not os.path.exists(path):
                os.makedirs(path)
            dest = os.path.join(path, os.path.basename(data))
            if os.path.exists(dest):
                os.unlink(dest)
            symlink.symlink(engine.GetFilename(filename), dest)

        # Map in any existing class files from the class cache
        engine.class_cache.PopulateFromCache(outprefix, self.sources)

        # Create an eclipse file
        with open(os.path.join(prefix, ".classpath"), "w") as f:
            f.write("""<?xml version="1.0" encoding="UTF-8"?>
<classpath>
  <classpathentry kind="src" path="src"/>
  <classpathentry kind="output" path="classes"/>
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
""")
            for jar in self.jars:
                f.write('<classpathentry kind="lib" path="jars/%s"/>\n' %
                        os.path.basename(jar))
            f.write("</classpath>\n")

        # Create a findbugs file
        with open(os.path.join(prefix, "findbugs.fbp"), "w") as f:
            loc = os.path.abspath(prefix)
            f.write('<Project projectName="">\n')
            for jar in self.jars:
                f.write("<AuxClasspathEntry>%s</AuxClasspathEntry>\n" %
                        os.path.join(loc, "jars", os.path.basename(jar)))
            f.write("<Jar>%s</Jar>\n" % os.path.join(loc, "classes"))
            f.write("<SrcDir>%s</SrcDir>\n" % os.path.join(loc, "src"))
            f.write("""<SuppressionFilter>
<LastVersion value="-1" relOp="NEQ"/>
</SuppressionFilter>
""")
            f.write("</Project>\n")
コード例 #8
0
ファイル: engine.py プロジェクト: Jovena/icbm
    def Setup(self, engine):
        # Create the prefix where we're going to build everything
        prefix = self.prefix = os.path.join(BUILD_DIR, self.name)
        if not os.path.exists(prefix):
            os.makedirs(prefix)

        # Link in the compile.xml which will tell ant to build things
        compile_xml = os.path.join(prefix, "compile.xml")
        if not os.path.exists(compile_xml):
            symlink.symlink(
                os.path.join(ICBM_PATH, "compile.xml"),
                compile_xml)

        # Set up the src/ directory, by symlinking in all the
        # depending source files.
        srcprefix = self.srcprefix = os.path.join(prefix, "src")
        if os.path.exists(srcprefix):
            shutil.rmtree(srcprefix)
        os.makedirs(srcprefix)
        for source, filename in self.sources.iteritems():
            path = os.path.join(srcprefix, os.path.dirname(source))
            if not os.path.exists(path):
                os.makedirs(path)
            dest = os.path.join(path, os.path.basename(source))
            symlink.symlink(engine.GetFilename(filename), dest)

        # Set up the jars/ directory by symlinking in all the depending jars.
        jarprefix = self.jarprefix = os.path.join(prefix, "jars")
        if os.path.exists(jarprefix):
            shutil.rmtree(jarprefix)
        os.makedirs(jarprefix)
        for jar, filename in self.jars.iteritems():
            symlink.symlink(engine.GetFilename(filename),
                            os.path.join(jarprefix, os.path.basename(jar)))

        # Set up the output directory where all the class files will go
        outprefix = self.outprefix = os.path.join(prefix, "classes")
        if not os.path.exists(outprefix):
            os.makedirs(outprefix)

        # Data files are meant to be on the classpath, so put them
        # into classes as well.
        for data, filename in self.data.iteritems():
            path = os.path.join(outprefix, os.path.dirname(data))
            if not os.path.exists(path):
                os.makedirs(path)
            dest = os.path.join(path, os.path.basename(data))
            if os.path.exists(dest):
                os.unlink(dest)
            symlink.symlink(engine.GetFilename(filename), dest)

        # Map in any existing class files from the class cache
        engine.class_cache.PopulateFromCache(outprefix, self.sources)

        # Create an eclipse file
        with open(os.path.join(prefix, ".classpath"), "w") as f:
            f.write("""<?xml version="1.0" encoding="UTF-8"?>
<classpath>
  <classpathentry kind="src" path="src"/>
  <classpathentry kind="output" path="classes"/>
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
""")
            for jar in self.jars:
                f.write('<classpathentry kind="lib" path="jars/%s"/>\n' %
                        os.path.basename(jar))
            f.write("</classpath>\n")

        # Create a findbugs file
        with open(os.path.join(prefix, "findbugs.fbp"), "w") as f:
            loc = os.path.abspath(prefix)
            f.write('<Project projectName="">\n')
            for jar in self.jars:
                f.write("<AuxClasspathEntry>%s</AuxClasspathEntry>\n" %
                        os.path.join(loc, "jars", os.path.basename(jar)))
            f.write("<Jar>%s</Jar>\n" % os.path.join(loc, "classes"))
            f.write("<SrcDir>%s</SrcDir>\n" % os.path.join(loc, "src"))
            f.write("""<SuppressionFilter>
<LastVersion value="-1" relOp="NEQ"/>
</SuppressionFilter>
""")
            f.write("</Project>\n")