Author: jannis
Date: 2006-07-11 22:07:24 +0000 (Tue, 11 Jul 2006)
New Revision: 22410

Modified:
   installit/trunk/ChangeLog
   installit/trunk/components/packages.py
   installit/trunk/i18n/po/de.po
   installit/trunk/i18n/po/i2t.pot
   installit/trunk/tools/env.py
Log:
        * i18n/po/de.po, i18n/po/i2t.po: New strings merged.
        * tools/env.py: Add link() and hasLibrary() methods.
        * components/packages.py: Use Environment.hasLibrary method to detect
          libraries using libtool. First tests look promising.

Modified: installit/trunk/ChangeLog
===================================================================
--- installit/trunk/ChangeLog   2006-07-11 22:00:10 UTC (rev 22409)
+++ installit/trunk/ChangeLog   2006-07-11 22:07:24 UTC (rev 22410)
@@ -1,3 +1,10 @@
+2006-07-12     Jannis Pohlmann <[EMAIL PROTECTED]>
+
+       * i18n/po/de.po, i18n/po/i2t.po: New strings merged.
+       * tools/env.py: Add link() and hasLibrary() methods.
+       * components/packages.py: Use Environment.hasLibrary method to detect
+         libraries using libtool. First tests look promising.
+
 2006-07-11     Jannis Pohlmann <[EMAIL PROTECTED]>
 
        * i18n/po/i2t.pot, i18n/po/de.po, i18n/po/POTFILES.in: New strings

Modified: installit/trunk/components/packages.py
===================================================================
--- installit/trunk/components/packages.py      2006-07-11 22:00:10 UTC (rev 
22409)
+++ installit/trunk/components/packages.py      2006-07-11 22:07:24 UTC (rev 
22410)
@@ -151,6 +151,13 @@
         self.path = path
 
 
+class Library:
+
+    def __init__(self, name, path):
+        self.name = name
+        self.path = path
+
+
 class ProgramNotFoundError(Exception):
     pass
 
@@ -538,9 +545,13 @@
                     pkg = PkgConfig.resolve(dep["name"], dep["version"])
                 except PkgConfigModuleNotFound:
                     if Config.get("UseLibrarySearch"):
-                        # TODO: Replace the line below with a call of the
-                        # Library lookup class
-                        pkg = UnresolvedPackage(dep["name"], dep["version"])
+                        ## TODO: Replace the line below with a call of the
+                        ## Library lookup class
+                        if Environment.hasLibrary(dep["name"], dep["version"]):
+                            return Library(dep["name"], dep["version"])
+                        else:
+                            return UnresolvedPackage(dep["name"],
+                                    dep["version"])
                     else:
                         # Mark this dependency as unresolved and try resolving
                         # it manually during installation.

Modified: installit/trunk/i18n/po/de.po
===================================================================
--- installit/trunk/i18n/po/de.po       2006-07-11 22:00:10 UTC (rev 22409)
+++ installit/trunk/i18n/po/de.po       2006-07-11 22:07:24 UTC (rev 22410)
@@ -7,8 +7,8 @@
 msgstr ""
 "Project-Id-Version: InstallIt 0.1beta1\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-07-11 23:25+0200\n"
-"PO-Revision-Date: 2006-07-11 23:27+0100\n"
+"POT-Creation-Date: 2006-07-12 00:04+0200\n"
+"PO-Revision-Date: 2006-07-12 00:07+0100\n"
 "Last-Translator: Jannis Pohlmann <[EMAIL PROTECTED]>\n"
 "Language-Team: German <[EMAIL PROTECTED]>\n"
 "MIME-Version: 1.0\n"
@@ -114,7 +114,7 @@
 msgid "Installing %(name)s %(version)s ..."
 msgstr "Installiere %(name)s %(version)s ..."
 
-#: ../..//components/packages.py:343
+#: ../..//components/packages.py:350
 #, python-format
 msgid "Could not parse package description %s: %s"
 msgstr "Konnte Paketbeschreibung %s nicht lesen: %s"
@@ -441,6 +441,16 @@
 msgid "Failed to compile %s."
 msgstr "Konnte %s nicht übersetzen."
 
+#: ../..//tools/env.py:105
+#, python-format
+msgid "Linking %s with %s"
+msgstr "Verlinke %s mit %s"
+
+#: ../..//tools/env.py:111
+#, python-format
+msgid "Failed to link %s."
+msgstr "Konnte %s nicht verlinken."
+
 #: ../..//tools/pkgconfig.py:37
 #, python-format
 msgid "pkg-config module missing: %(name)s (%(version)s)."

Modified: installit/trunk/i18n/po/i2t.pot
===================================================================
--- installit/trunk/i18n/po/i2t.pot     2006-07-11 22:00:10 UTC (rev 22409)
+++ installit/trunk/i18n/po/i2t.pot     2006-07-11 22:07:24 UTC (rev 22410)
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2006-07-11 23:25+0200\n"
+"POT-Creation-Date: 2006-07-12 00:04+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <[EMAIL PROTECTED]>\n"
 "Language-Team: LANGUAGE <[EMAIL PROTECTED]>\n"
@@ -112,7 +112,7 @@
 msgid "Installing %(name)s %(version)s ..."
 msgstr ""
 
-#: ../..//components/packages.py:343
+#: ../..//components/packages.py:350
 #, python-format
 msgid "Could not parse package description %s: %s"
 msgstr ""
@@ -438,6 +438,16 @@
 msgid "Failed to compile %s."
 msgstr ""
 
+#: ../..//tools/env.py:105
+#, python-format
+msgid "Linking %s with %s"
+msgstr ""
+
+#: ../..//tools/env.py:111
+#, python-format
+msgid "Failed to link %s."
+msgstr ""
+
 #: ../..//tools/pkgconfig.py:37
 #, python-format
 msgid "pkg-config module missing: %(name)s (%(version)s)."

Modified: installit/trunk/tools/env.py
===================================================================
--- installit/trunk/tools/env.py        2006-07-11 22:00:10 UTC (rev 22409)
+++ installit/trunk/tools/env.py        2006-07-11 22:07:24 UTC (rev 22410)
@@ -97,6 +97,34 @@
             Logger.error("Environment", _("Failed to compile %s.") % (source))
             return False
 
+    def link(self, source, library):
+        command = "%s --mode=link %s -o %s %s -l%s" % \
+                (self.getLibtool(), os.path.basename(self.getCompiler()),
+                 source + ".linked", source, library)
+
+        Logger.debug("Environment", _("Linking %s with %s") 
+                % (source, library))
+
+        if commands.getstatusoutput(command)[0] == os.EX_OK:
+            return True
+        else:
+            Logger.error("Environment", _("Failed to link %s.") % (source))
+            return False
+
+    def hasLibrary(self, name, version):
+        source = os.path.join(Config.get("DataDir"), "test.o")
+
+        # Try linking against the library (without version)
+        if self.link(source, name):
+            return True
+
+        # Try linking against the library (with version)
+        if self.link(source, name + "-" + version):
+            return True
+
+        # No direct linking possible
+        return False
+
     def hasGnuLinker(self):
         return "GNU ld" in commands.getstatusoutput("ld -v")[1]
 

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to