Bogdan Stanciu has proposed merging lp:~bstanciu/openobject-client/trunk-dev 
into lp:openobject-client.

Requested reviews:
  OpenERP sa GTK client R&D (openerp-dev-gtk)
Related bugs:
  #696991 unable to install openerp-client rc2 on fedora 12
  https://bugs.launchpad.net/bugs/696991

For more details, see:
https://code.launchpad.net/~bstanciu/openobject-client/trunk-dev/+merge/45613
-- 
https://code.launchpad.net/~bstanciu/openobject-client/trunk-dev/+merge/45613
Your team OpenERP sa GTK client R&D is requested to review the proposed merge 
of lp:~bstanciu/openobject-client/trunk-dev into lp:openobject-client.
=== modified file 'mydistutils.py'
--- mydistutils.py	2009-10-20 10:55:28 +0000
+++ mydistutils.py	2011-01-08 19:04:14 +0000
@@ -25,77 +25,51 @@
 import sys
 import os
 import os.path
-import re
-import glob
-import commands
-import types
 import msgfmt
 
-from distutils.core import Command
-from distutils.command.build import build
-from distutils.command.install import install
+from setuptools import Command, Distribution
+from distutils.command.build_scripts import build_scripts
+from setuptools.command.install import install
 from distutils.command.install_data import install_data
 from distutils.dep_util import newer
-from distutils.dist import Distribution
-from distutils.core import setup
+import distutils.core
+
+from distutils.errors import DistutilsSetupError
 
 try:
     from dsextras import BuildExt
+    _pyflakes_hush = [ BuildExt, ]
 except ImportError:
     try:
         from gtk.dsextras import BuildExt
+        _pyflakes_hush = [ BuildExt, ]
     except ImportError:
         sys.exit('Error: Can not find dsextras or gtk.dsextras')
 
 # get python short version
 py_short_version = '%s.%s' % sys.version_info[:2]
 
-
-class l10napp_build(build):
-
-    def has_po_files(self):
-        return self.distribution.has_po_files()
-
-    sub_commands = []
-    sub_commands.append(('build_conf', None))
-    sub_commands.extend(build.sub_commands)
-    sub_commands.append(('build_mo', has_po_files))
-
-class l10napp_install(install):
-
-    def has_po_files(self):
-        return self.distribution.has_po_files()
-
-    def run(self):
-        # create startup script
-        # start_script = "#!/bin/sh\ncd %s\nexec %s ./openerp-client.py $...@\n" % (opj(self.install_libbase, "openerp-client"), sys.executable)
-        opj = os.path.join
-        openerp_site_packages = opj('/usr', 'lib', 'python%s' % py_short_version, 'site-packages', 'openerp-client')
-        start_script = "#!/bin/sh\ncd %s\nexec %s ./openerp-client.py $...@\n" % (openerp_site_packages, sys.executable)
-        # write script
-        f = open('openerp-client', 'w')
-        f.write(start_script)
-        f.close()
-        install.run(self)
-
-    sub_commands = []
-    sub_commands.extend(install.sub_commands)
-    sub_commands.append(('install_mo', has_po_files))
-
-class build_conf(Command):
-
-    description = 'update conf file'
-
-    user_options = []
-
-    def initialize_options(self):
-        self.prefix = None
-
-    def finalize_options(self):
-        self.set_undefined_options('install', ('prefix', 'prefix'))
-
-    def run(self):
-        self.announce('Building files from templates')
+class build_scripts_app(build_scripts):
+    """ Create the shortcut to the application
+    """
+
+    description = 'build the OpenERP Client Linux script'
+
+    def get_source_files(self):
+        return [ x for x in self.scripts if x != 'openerp-client']
+
+    def run(self):
+        if sys.platform != 'win32':
+            self.announce("create startup script")
+            opj = os.path.join
+
+            openerp_site_packages = opj('/usr', 'local', 'lib', 'python%s' % py_short_version, 'dist-packages', 'openerp-client')
+            start_script = "#!/bin/sh\ncd %s\nexec %s ./openerp-client.py $...@\n" % (openerp_site_packages, sys.executable)
+            # write script
+            f = open('openerp-client', 'w')
+            f.write(start_script)
+            f.close()
+        build_scripts.run(self)
 
 class build_mo(Command):
 
@@ -108,20 +82,22 @@
         self.build_base = None
         self.translations = self.distribution.translations
         self.force = None
+
     def finalize_options(self):
         self.set_undefined_options('build',
                                    ('build_base', 'build_base'),
                                    ('force', 'force'))
     def run(self):
+        if not self.translations:
+            return
         self.announce('Building binary message catalog')
-        if self.distribution.has_po_files():
-            for mo, po in self.translations:
-                dest = os.path.normpath(self.build_base + '/' + mo)
-                self.mkpath(os.path.dirname(dest))
-                if not self.force and not newer(po, dest):
-                    self.announce("not building %s (up-to-date)" % dest)
-                else:
-                    msgfmt.make(po, dest)
+        for mo, po in self.translations:
+            dest = os.path.normpath( os.path.join(self.build_base, mo))
+            self.mkpath(os.path.dirname(dest))
+            if not self.force and not newer(po, dest):
+                self.announce("not building %s (up-to-date)" % dest)
+            else:
+                msgfmt.make(po, dest)
 
 class install_mo(install_data):
 
@@ -130,7 +106,6 @@
     def initialize_options(self):
         install_data.initialize_options(self)
         self.translations = self.distribution.translations
-        self.has_po_files = self.distribution.has_po_files
         self.install_dir = None
         self.build_dir = None
         self.skip_build = None
@@ -145,7 +120,7 @@
     def run(self):
         if not self.skip_build:
             self.run_command('build_mo')
-        if self.has_po_files():
+        if self.translations:
             for mo, po in self.translations:
                 src = os.path.normpath(self.build_dir + '/' + mo)
                 if not os.path.isabs(mo):
@@ -164,29 +139,17 @@
     def get_inputs (self):
         return [ po for mo, po in self.translations ]
 
-class L10nAppDistribution(Distribution):
-    def __init__(self, attrs = None):
-        self.modules_check = 0
-        self.gconf = 1
-        self.msg_sources = None
+class ClientDistribution(Distribution):
+    def __init__(self, attrs=None):
         self.translations = []
-        self.name = attrs.get('name')
         Distribution.__init__(self, attrs)
         self.cmdclass = {
-            'install' : l10napp_install,
             'install_mo' : install_mo,
-            'build' : l10napp_build,
             'build_mo' : build_mo,
-            'build_conf' : build_conf,
+            # 'build_conf' : build_conf,
             'build_ext': BuildExt,
+            'build_scripts': build_scripts_app,
             }
-
-    def has_po_files(self):
-        return len(self.translations) > 0
-    
-def setup(**kwds):
-    from distutils.core import setup
-    kwds['distclass'] = L10nAppDistribution
-    setup(**kwds)
-
-# vim:expandtab:tw=80
+        self.command_obj['build_scripts'] = None
+
+#eof

=== modified file 'setup.py'
--- setup.py	2010-12-29 19:55:53 +0000
+++ setup.py	2011-01-08 19:04:14 +0000
@@ -30,7 +30,9 @@
 import glob
 
 from setuptools import setup
+from setuptools.command.install import install as suc_install
 from distutils.sysconfig import get_python_lib
+from mydistutils import ClientDistribution
 
 has_py2exe = False
 if sys.platform == 'win32':
@@ -50,7 +52,7 @@
 
 execfile(opj('bin', 'release.py'))
 
-if sys.argv[1] == 'bdist_rpm':
+if len(sys.argv) > 1 and sys.argv[1] == 'bdist_rpm':
     version = version.split('-')[0]
 
 # get python short version
@@ -89,11 +91,6 @@
 
 included_plugins = ['workflow_print']
 
-f = file('openerp-client','w')
-start_script = """#!/bin/sh\necho "OpenERP Setup - The content of this file is generated at the install stage" """
-f.write(start_script)
-f.close()
-
 def find_plugins():
     for plugin in included_plugins:
         path=opj('bin', 'plugins', plugin)
@@ -148,9 +145,12 @@
         {
             'script' : os.path.join('bin', 'openerp-client.py'),
             'icon_resources' : [(1, os.path.join('bin', 'pixmaps', 'openerp-icon.ico'))],
+            'install_requires': [ 'PyGTK', ],
         }
     ]
 
+suc_install.sub_commands.append(('install_mo',  None))
+
 setup(name             = name,
       version          = version,
       description      = description,
@@ -158,11 +158,12 @@
       url              = url,
       author           = author,
       author_email     = author_email,
+      distclass        = ClientDistribution,
       classifiers      = filter(None, classifiers.splitlines()),
       license          = license,
       data_files       = data_files(),
       translations     = translations(),
-      scripts          = ['openerp-client'],
+      scripts          = ['openerp-client',],
       packages         = ['openerp-client',
                           'openerp-client.common',
                           'openerp-client.modules',
@@ -182,9 +183,9 @@
                           'openerp-client.widget.view.form_gtk',
                           'openerp-client.widget.view.tree_gtk',
                           'openerp-client.widget.view.graph_gtk',
+                          'openerp-client.widget.view.diagram_gtk',
                           'openerp-client.widget.view.calendar_gtk',
                           'openerp-client.widget.view.gantt_gtk',
-                          'openerp-client.widget.view.diagram_gtk',
                           'openerp-client.widget_search',
                           'openerp-client.SpiffGtkWidgets',
                           'openerp-client.SpiffGtkWidgets.Calendar',
@@ -194,8 +195,7 @@
       install_requires = [
           'lxml',
           'pytz',
-          'PyGTK',
           'python-dateutil',
       ],
       **complementary_arguments
-)
+)
\ No newline at end of file

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to