[postr] Fixed destination to install Nautilus extension (#593153)



commit bf84cc03e88615ad4b0b67fb569231395804f400
Author: Tim Lauridsen <tla rasmil dk>
Date:   Wed Nov 4 19:31:09 2009 -0300

    Fixed destination to install Nautilus extension (#593153)
    
    pkg-config is used to determine the destination folder
    to install the plugin for Nautilus.
    
    Signed-off-by: Germán Póo-Caamaño <gpoo gnome org>

 setup.py |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/setup.py b/setup.py
index bb939ce..d81782b 100644
--- a/setup.py
+++ b/setup.py
@@ -1,9 +1,30 @@
 #!/usr/bin/env python
 
+import os
 from distutils.core import setup
+from distutils.command.install_data import install_data
 from glob import glob
 from src.version import __version__
 
+
+class InstallData(install_data):
+    def run(self):
+        self.data_files.extend(self._nautilus_plugin())
+        install_data.run(self)
+
+    def _nautilus_plugin(self):
+        files = []
+        cmd = os.popen('pkg-config --variable=pythondir nautilus-python', 'r')
+        res = cmd.readline().strip()
+        ret = cmd.close()
+
+        if ret is None:
+            dest = res[5:]
+            files.append((dest, ['nautilus/postrExtension.py']))
+
+        return files
+
+
 setup(name='Postr',
       version=__version__,
       description='Flickr Uploader',
@@ -21,11 +42,8 @@ setup(name='Postr',
                   ('share/icons/hicolor/24x24/apps', glob('data/24x24/*.png')),
                   ('share/icons/hicolor/32x32/apps', glob('data/32x32/*.png')),
                   ('share/icons/hicolor/scalable/apps', glob('data/scalable/*.svg')),
-                  # TODO: inspect nautilus-python.pc to get path
-                  ('lib/nautilus/extensions-1.0/python', ['nautilus/postrExtension.py']),
-                  ('lib/nautilus/extensions-2.0/python', ['nautilus/postrExtension.py']),
-                  ],
-      
+                  ], cmdclass={'install_data': InstallData}
+
       )
 
 # TODO: install translations



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]