Example #1
0
    def __init__(self, node):
        self.prefixes = {}

        prefixes = utils.node_get_elements_by_tag_name(node, "prefix")
        for child in prefixes:
            name = child.getAttribute("name")
            if len(name) == 0:
                name = "default"
            value = utils.evaluate_environment_variables(
                utils.node_get_string(child))
            self.prefixes[name] = value

        child = utils.node_get_element_by_tag_name(node, "image")
        if child:
            pass  # FIXME: implement

        child = utils.node_get_element_by_tag_name(node,
                                                   "run-install-name-tool")
        if child:
            self.run_install_name_tool = True
        else:
            self.run_install_name_tool = False

        child = utils.node_get_element_by_tag_name(node, "destination")
        self.overwrite = utils.node_get_property_boolean(
            child, "overwrite", False)
        self.dest = utils.node_get_string(child, "${project}")
Example #2
0
    def __init__(self, node):
        self.prefixes = {}

        prefixes = utils.node_get_elements_by_tag_name(node, "prefix")
        for child in prefixes:
            name = child.getAttribute("name")
            if len(name) == 0:
                name = "default"
            value = utils.evaluate_environment_variables(utils.node_get_string(child))
            self.prefixes[name] = value

        child = utils.node_get_element_by_tag_name(node, "image")
        if child:
            pass # FIXME: implement
        
        child = utils.node_get_element_by_tag_name(node, "run-install-name-tool")
        if child:
            self.run_install_name_tool = True
        else:
            self.run_install_name_tool = False

        child = utils.node_get_element_by_tag_name(node, "destination")
        self.overwrite = utils.node_get_property_boolean(child, "overwrite", False)
        self.dest = utils.node_get_string(child, "${project}")

        child = utils.node_get_element_by_tag_name(node, "gtk")
        if child:
            self.gtk = utils.node_get_string(child)
        else:
            self.gtk = "gtk+-2.0"
Example #3
0
    def __init__(self, project_path=None):
        if not os.path.isabs(project_path):
            project_path = os.path.join(os.getcwd(), project_path)
        self.project_path = project_path
        self.root = None

        if project_path and os.path.exists(project_path):
            try:
                doc = xml.dom.minidom.parse(project_path)
                # Get the first app-bundle tag and ignore any others.
                self.root = utils.node_get_element_by_tag_name(
                    doc, "app-bundle")
            except:
                print "Could not load project %s:" % (project_path)
                raise

        # The directory the project file is in (as opposed to
        # project_path which is the path including the filename).
        self.project_dir, tail = os.path.split(project_path)

        plist_path = self.get_plist_path()
        try:
            plist = Plist.fromFile(plist_path)
        except EnvironmentError, e:
            if e.errno == errno.ENOENT:
                print "Info.plist file not found: " + plist_path
                sys.exit(1)
            else:
                raise
Example #4
0
    def __init__(self, project_path=None):
        if not os.path.isabs(project_path):
            project_path = os.path.join(os.getcwd(), project_path)
        self.project_path = project_path
        self.root = None

        if project_path and os.path.exists(project_path):
            try:
                doc = xml.dom.minidom.parse(project_path)
                # Get the first app-bundle tag and ignore any others.
                self.root = utils.node_get_element_by_tag_name(doc, "app-bundle")
            except:
                print "Could not load project %s:" % (project_path)
                raise

        # The directory the project file is in (as opposed to
        # project_path which is the path including the filename).
        self.project_dir, tail = os.path.split(project_path)

        plist_path = self.get_plist_path()
        try:
            plist = Plist.fromFile(plist_path)
        except EnvironmentError, e:
            if e.errno == errno.ENOENT:
                print "Info.plist file not found: " + plist_path
                sys.exit(1)
            else:
                raise
Example #5
0
    def get_launcher_script(self):
        node = utils.node_get_element_by_tag_name(self.root, "launcher-script")
        if node:
            path = Path.from_node(node, False)
            path.dest = "${bundle}/Contents/MacOS/${name}"
        else:
            # Use the default launcher.
            launcher = os.path.join(os.path.dirname(__file__), "launcher.sh")
            path = Path(launcher, "${bundle}/Contents/MacOS/${name}")

        return path
Example #6
0
    def get_launcher_script(self):
        node = utils.node_get_element_by_tag_name(self.root, "launcher-script")
        if node:
            path = Path.from_node(node, False)
            path.dest = "${bundle}/Contents/MacOS/${name}"
        else:
            # Use the default launcher.
            launcher = os.path.join(os.path.dirname(__file__), "launcher.sh")
            path = Path(launcher, "${bundle}/Contents/MacOS/${name}")

        return path
Example #7
0
    def get_main_binary(self):
        node = utils.node_get_element_by_tag_name(self.root, "main-binary")
        if not node:
            raise Exception("The file has no <main-binary> tag")

        binary = Binary.from_node(node)

        launcher = self.get_launcher_script()
        if launcher:
            suffix = "-bin"
        else:
            suffix = ""
        binary.dest = "${bundle}/Contents/MacOS/${name}" + suffix

        return binary
Example #8
0
    def get_main_binary(self):
        node = utils.node_get_element_by_tag_name(self.root, "main-binary")
        if not node:
            raise Exception("The file has no <main-binary> tag")

        binary = Binary.from_node(node)

        launcher = self.get_launcher_script()
        if launcher:
            suffix = "-bin"
        else:
            suffix = ""
        binary.dest = "${bundle}/Contents/MacOS/${name}" + suffix

        return binary
Example #9
0
 def __init__(self, testxml, path):
     doc = xml.dom.minidom.parseString(testxml)
     self.root = utils.node_get_element_by_tag_name(doc, "app-bundle")
     assert self.root != None
     dir, tail = os.path.split(path)
     self.project_dir = os.path.join(os.getcwd(), dir)
     self.project_path = os.path.join(self.project_dir, tail)
     try:
         plist_path = os.path.join(self.project_dir, "test.plist")
         plist = Plist.fromFile(plist_path)
     except EnvironmentError, e:
         if e.errno == errno.ENOENT:
             print "Info.plist file not found: " + plist_path
             sys.exit(1)
         else:
             raise
 def __init__(self, testxml, path):
     doc = xml.dom.minidom.parseString(testxml)
     self.root = utils.node_get_element_by_tag_name(doc, "app-bundle")
     assert self.root != None
     dir, tail = os.path.split(path)
     self.project_dir = os.path.join(os.getcwd(), dir)
     self.project_path = os.path.join(self.project_dir, tail)
     try:
         plist_path = os.path.join(self.project_dir, "test.plist")
         plist = Plist.fromFile(plist_path)
     except EnvironmentError, e:
         if e.errno == errno.ENOENT:
             print "Info.plist file not found: " + plist_path
             sys.exit(1)
         else:
             raise
Example #11
0
 def get_environment(self):
     node = utils.node_get_element_by_tag_name(self.root, "environment")
     return Environment(node)
Example #12
0
 def get_meta(self):
     node = utils.node_get_element_by_tag_name(self.root, "meta")
     return Meta(node)
Example #13
0
 def get_plist_path(self):
     plist = utils.node_get_element_by_tag_name(self.root, "plist")
     if not plist:
         raise Exception("The 'plist' tag is required")
     return self.evaluate_path(utils.node_get_string(plist))
Example #14
0
 def get_environment(self):
     node = utils.node_get_element_by_tag_name(self.root, "environment")
     return Environment(node)
Example #15
0
 def get_meta(self):
     node = utils.node_get_element_by_tag_name(self.root, "meta")
     return Meta(node)
Example #16
0
 def get_plist_path(self):
     plist = utils.node_get_element_by_tag_name(self.root, "plist")
     if not plist:
         raise Exception("The 'plist' tag is required")
     return  self.evaluate_path(utils.node_get_string(plist))