← Back to team overview

savoirfairelinux-openerp team mailing list archive

lp:~savoirfairelinux-openerp/lp-community-utils/fix-pep8-and-add-new-projects into lp:lp-community-utils

 

Maxime Chambreuil (http://www.savoirfairelinux.com) has proposed merging lp:~savoirfairelinux-openerp/lp-community-utils/fix-pep8-and-add-new-projects into lp:lp-community-utils.

Requested reviews:
  OpenERP Community Reviewer (openerp-community-reviewer)

For more details, see:
https://code.launchpad.net/~savoirfairelinux-openerp/lp-community-utils/fix-pep8-and-add-new-projects/+merge/186938

[FIX] PEP8
[ADD] HR, ISP and Edition projects
-- 
https://code.launchpad.net/~savoirfairelinux-openerp/lp-community-utils/fix-pep8-and-add-new-projects/+merge/186938
Your team Savoir-faire Linux' OpenERP is subscribed to branch lp:~savoirfairelinux-openerp/lp-community-utils/fix-pep8-and-add-new-projects.
=== modified file 'README.rst'
--- README.rst	2013-01-03 08:17:37 +0000
+++ README.rst	2013-09-22 14:39:54 +0000
@@ -43,7 +43,7 @@
 Community Reviewers pool, it has to be added there.
 
 If someone can contribute to automatize the build of
-the projects list (if that where possible),
+the projects list (if that were possible),
 that would be great.
 
 

=== modified file 'clone_mp_to_community.py'
--- clone_mp_to_community.py	2013-04-24 08:13:56 +0000
+++ clone_mp_to_community.py	2013-09-22 14:39:54 +0000
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
-##############################################################################
+#
 #
 #    OpenERP, Open Source Management Solution
 #    This module copyright (C) 2013 Therp BV (<http://therp.nl>).
@@ -20,7 +20,7 @@
 #    You should have received a copy of the GNU Affero General Public License
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
-##############################################################################
+#
 import os
 import os.path
 import shutil
@@ -41,7 +41,7 @@
 
 load_plugins()
 
-#mapping from official projects/series to community series
+# mapping from official projects/series to community series
 project_mappings = {
     'openerp-web': {
         '6.1': 'lp:ocb-web/6.1',
@@ -61,6 +61,8 @@
 }
 
 api_base_url = 'https://api.launchpad.net/1.0/'
+
+
 def get_lp_json(url):
     """
     Load a launchpad API request in JSON format.
@@ -90,6 +92,7 @@
     request = urllib2.urlopen(api_url)
     return simplejson.load(request)
 
+
 def get_project_series(lp_url):
     """
     Split off the lp: part (or harmlessly 'htt' in the case of http 
@@ -98,6 +101,7 @@
     parts = lp_url[3:].split('/')
     return (parts[-2], parts[-1])
 
+
 def clone_merge_proposals(lp, source_branch_address,
                           target_branch_address=None,
                           reference_branch_address=None,
@@ -126,8 +130,8 @@
             logging.debug('Looking at possible target %s',
                           mp.target_branch.web_link)
             project, series = get_project_series(mp.target_branch.web_link)
-            if (project in project_mappings and 
-                series in project_mappings[project]):
+            if (project in project_mappings and
+                    series in project_mappings[project]):
                 target_branch_address = project_mappings[project][series]
                 original_target_branch_address = mp.target_branch.bzr_identity
                 break
@@ -135,7 +139,7 @@
                 logging.warning('Found a proposal on an unknown project '
                                 '\'%s\' or series \'%s\'', project, series)
 
-    if not mp: # i.e. there were no landing targets
+    if not mp:  # i.e. there were no landing targets
         logging.error('No merge proposal found for %s',
                       source_branch_address)
         return 1
@@ -153,11 +157,11 @@
             logging.debug('getting %s to create merge proposal to %s',
                           target_branch_address, target_branch_dir)
             cmd_branch().run(target_branch_address,
-                             to_location=target_branch_dir, stacked=True, 
+                             to_location=target_branch_dir, stacked=True,
                              use_existing_dir=True)
 
         target_branch = lp_api.LaunchpadBranch.from_bzr(lp,
-                Branch.open(target_branch_dir))
+                                                        Branch.open(target_branch_dir))
 
         replay_args = [target_branch_dir, source_branch_address]
         if reference_branch_address:
@@ -165,7 +169,7 @@
         elif original_target_branch_address:
             replay_args += ['-r', original_target_branch_address]
         logging.debug('start replay %s', replay_args)
-        
+
         try:
             replay_missing.main(replay_args)
         except ConflictsInTree:
@@ -188,7 +192,7 @@
 
         logging.debug('pushing to %s', push_location)
         push = cmd_push()
-        #TODO: because of this, bzr's output doesn't end up in our logger
+        # TODO: because of this, bzr's output doesn't end up in our logger
         push._setup_outf()
         push.run(
             location=push_location, directory=target_branch_dir, stacked=True)
@@ -199,10 +203,10 @@
             initial_comment += (' Below is a copy of the original '
                                 'description.\n\n%s' % mp.description)
         lp.branches.getByUrl(url=push_location).createMergeProposal(
-                commit_message=mp.commit_message,
-                initial_comment=initial_comment,
-                needs_review=True, 
-                target_branch=target_branch.lp)
+            commit_message=mp.commit_message,
+            initial_comment=initial_comment,
+            needs_review=True,
+            target_branch=target_branch.lp)
 
         shutil.rmtree(target_branch_dir)
     else:
@@ -210,28 +214,28 @@
             'No target branch specified and no proposal found for %s '
             'on any mapped project and series', source_branch_address)
 
- 
+
 def main(argv=None):
     parser = argparse.ArgumentParser()
-    parser.add_argument('--mp-branch-dir', dest='mp_branch_dir', 
-        help="the local directory of the merge proposal\'s branch")
-    parser.add_argument('--mp-url', dest='mp_url', 
-        help="the merge proposal's web address on launchpad")
-    parser.add_argument('--reference-branch', '-r', dest='reference_branch', 
-        help=("Only replay commits that are not present in this branch. This "
-              "would usually be a local copy of the original target branch "
-              "of the merge proposal"))
-    parser.add_argument('--target-branch', dest='target_branch', 
-        help="override automagicly chosen target branch")
+    parser.add_argument('--mp-branch-dir', dest='mp_branch_dir',
+                        help="the local directory of the merge proposal\'s branch")
+    parser.add_argument('--mp-url', dest='mp_url',
+                        help="the merge proposal's web address on launchpad")
+    parser.add_argument('--reference-branch', '-r', dest='reference_branch',
+                        help=("Only replay commits that are not present in this branch. This "
+                              "would usually be a local copy of the original target branch "
+                              "of the merge proposal"))
+    parser.add_argument('--target-branch', dest='target_branch',
+                        help="override automagicly chosen target branch")
     parser.add_argument('--target-copy', '-c',
-        help="Directory to use as a local copy of the target branch. This "
-             "prevents downloading the branch from Launchpad.")
+                        help="Directory to use as a local copy of the target branch. This "
+                        "prevents downloading the branch from Launchpad.")
     parser.add_argument('-d', '--debug', dest='loglevel', action='store_const',
-            const='DEBUG', help='debug output')
+                        const='DEBUG', help='debug output')
     parser.add_argument('-q', '--quiet', dest='loglevel', action='store_const',
-            const='ERROR', help='be quiet')
+                        const='ERROR', help='be quiet')
     arguments = parser.parse_args(argv)
-    
+
     if arguments.loglevel:
         logging.getLogger().setLevel(getattr(logging, arguments.loglevel))
 
@@ -266,15 +270,15 @@
         except bzrlib.errors.NotBranchError:
             if not source_branch_location:
                 logging.error('current directory is not a branch and I got no '
-                        'merge proposal - giving up')
+                              'merge proposal - giving up')
                 return 1
-    
+
     try:
-        clone_merge_proposals(lp, source_branch_location, 
-                target_branch_address=arguments.target_branch,
-                reference_branch_address=(arguments.reference_branch
-                                          or original_target_branch_location),
-                target_copy=arguments.target_copy)
+        clone_merge_proposals(lp, source_branch_location,
+                              target_branch_address=arguments.target_branch,
+                              reference_branch_address=(arguments.reference_branch
+                                                        or original_target_branch_location),
+                              target_copy=arguments.target_copy)
 
     except bzrlib.errors.NotBranchError as e:
         logging.error('found no branch to work on - branch dir is %s',
@@ -283,5 +287,6 @@
 
 if __name__ == "__main__":
     import sys
-    logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
+    logging.basicConfig(
+        format='%(levelname)s: %(message)s', level=logging.INFO)
     sys.exit(main(sys.argv[1:]))

=== modified file 'merge_mp.py'
--- merge_mp.py	2013-04-24 08:19:34 +0000
+++ merge_mp.py	2013-09-22 14:39:54 +0000
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
-##############################################################################
+#
 #
 #    OpenERP, Open Source Management Solution
 #    This module copyright (C) 2013 Therp BV (<http://therp.nl>).
@@ -20,24 +20,24 @@
 #    You should have received a copy of the GNU Affero General Public License
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
-##############################################################################
+#
 import sys
 import argparse
 import tempfile
 import shutil
 import logging
 from bzrlib.builtins import (cmd_branch, cmd_push, cmd_merge, cmd_commit,
-    cmd_pull)
+                             cmd_pull)
 import clone_mp_to_community
 
 logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
 
 parser = argparse.ArgumentParser()
 parser.add_argument('mp_url',
-    help='The URL of the merge proposal on Launchpad')
+                    help='The URL of the merge proposal on Launchpad')
 parser.add_argument('--target-copy', '-c',
-    help='Directory to use as a local copy of the target branch.\n'
-    'This prevents downloading the branch from Launchpad.')
+                    help='Directory to use as a local copy of the target branch.\n'
+                    'This prevents downloading the branch from Launchpad.')
 parser.add_argument('--commit-message', '-m', help='Override commit message')
 arguments = parser.parse_args()
 
@@ -47,7 +47,7 @@
 
 if not mp['commit_message'] and not arguments.commit_message:
     print 'The merge proposal contains no commit message. '\
-    'Give one as parameter!'
+        'Give one as parameter!'
     sys.exit()
 
 branch_dir = tempfile.mkdtemp()
@@ -60,14 +60,14 @@
     pull_command.run(directory=branch_dir)
 else:
     cmd_branch().run(lp_target['bzr_identity'], to_location=branch_dir,
-        stacked=True, use_existing_dir=True)
+                     stacked=True, use_existing_dir=True)
 
 merge_command = cmd_merge()
 merge_command._setup_outf()
 merge_command.run(lp_source['bzr_identity'], directory=branch_dir)
 
 cmd_commit().run(message=arguments.commit_message or mp['commit_message'],
-    selected_list=[branch_dir])
+                 selected_list=[branch_dir])
 
 push_command = cmd_push()
 push_command._setup_outf()

=== modified file 'openerp-nag'
--- openerp-nag	2013-06-13 08:00:49 +0000
+++ openerp-nag	2013-09-22 14:39:54 +0000
@@ -231,15 +231,15 @@
         logging.info("Looking for things to nag about under %s", project_name)
         nags.extend(gen_project_nags(lp, policy, project_name))
     nags.sort(key=lambda nag: (nag.sort_class, nag.sort_priority,
-                                    nag.sort_age))
+                               nag.sort_age))
     print("=" * 80)
     print("Done thinking, here's the nag list".center(80))
     print("=" * 80)
     for index1, nag in enumerate(nags, 1):
         print("{index1:-2}: [age {age}] {person} should {action} {subject} "
               "on the project {project}".format(
-            index1=index1, age=(nag.sort_age and -nag.sort_age), person=nag.person,
-            action=nag.action, subject=nag.subject, project=nag.project_name))
+                  index1=index1, age=(nag.sort_age and -nag.sort_age), person=nag.person,
+                  action=nag.action, subject=nag.subject, project=nag.project_name))
 
 
 if __name__ == "__main__":

=== modified file 'projects'
--- projects	2013-04-29 06:19:10 +0000
+++ projects	2013-09-22 14:39:54 +0000
@@ -18,11 +18,17 @@
 knowledge-addons
 lp-community-utils
 margin-analysis
+ocb-addons
+ocb-server
+ocb-web
 oemedical
 openerp-accountedge
 openerp-construction
+openerp-edition
 openerp-fiscal-rules
+openerp-hr
 openerp-icm
+openerp-isp
 openerp-library
 openerp-lims-connect
 openerp-manufacturing
@@ -51,6 +57,3 @@
 sugarcrm-openerp
 web-addons
 webkit-utils
-ocb-addons
-ocb-server
-ocb-web

=== modified file 'replay_missing.py'
--- replay_missing.py	2013-04-24 08:18:30 +0000
+++ replay_missing.py	2013-09-22 14:39:54 +0000
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
-##############################################################################
+#
 #
 #    OpenERP, Open Source Management Solution
 #    This module copyright (C) 2013 Therp BV (<http://therp.nl>).
@@ -23,7 +23,7 @@
 #    You should have received a copy of the GNU Affero General Public License
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
-##############################################################################
+#
 import sys
 import argparse
 from os.path import isdir
@@ -33,7 +33,7 @@
 from bzrlib.errors import (
     NoSuchRevision,
     UnknownErrorFromSmartServer,
-    )
+)
 from bzrlib.generate_ids import gen_revision_id
 from bzrlib.option import _parse_revision_str
 from bzrlib.plugins.launchpad.lp_directory import LaunchpadDirectory
@@ -41,6 +41,7 @@
 from bzrlib.workingtree import WorkingTree
 import logging
 
+
 def replay_missing(
         wt, upstream_location, alternative_reference=False, do_nothing=False):
     """
@@ -101,12 +102,12 @@
         finally:
             source.unlock()
         return result
-        
+
     upstream = Branch.open_containing(upstream_location)[0]
     logging.debug('finding differences')
     _, todo_set = find_difference(wt.branch, upstream)
     logging.debug("%s revisions not in the reference branch", len(todo_set))
-    
+
     if alternative_reference:
         _, wt_todo_set = find_difference(wt.branch, alternative_reference)
         todo_set = todo_set.difference(wt_todo_set)
@@ -136,14 +137,15 @@
                      revno, upstream_location, revid)
         if not do_nothing:
             revisionspec = _parse_revision_str(
-                "%s..%s" % (int(revno) -1, int(revno)))
+                "%s..%s" % (int(revno) - 1, int(revno)))
             cmd_merge().run(location=upstream.base,
-                          revision=revisionspec,
-                          directory=wt.branch.base) 
+                            revision=revisionspec,
+                            directory=wt.branch.base)
             oldrev = wt.branch.repository.get_revision(revid)
             revid = gen_revision_id(oldrev.committer, oldrev.timestamp)
             commit_missing(wt, oldrev, revid)
 
+
 def main(argv):
     parser = argparse.ArgumentParser()
     parser.add_argument(
@@ -158,7 +160,7 @@
         help='Log level (default is \'INFO\')')
     parser.add_argument('wt_directory', help='local branch or checkout')
     parser.add_argument('upstream_branches', nargs='+',
-            help='upstream branch', metavar='upstream_branch')
+                        help='upstream branch', metavar='upstream_branch')
 
     arguments = parser.parse_args(argv)
 
@@ -173,9 +175,9 @@
         reference = Branch.open(arguments.reference)
         if reference.get_master_branch():
             sys.exit("%s is a bound branch. Please unbind\n" %
-                arguments.reference)
+                     arguments.reference)
         if isinstance(transport.get_transport(arguments.reference),
-                transport.local.LocalTransport):
+                      transport.local.LocalTransport):
             logging.debug('pulling %s to %s',
                           reference.get_parent(),
                           reference.base)
@@ -195,5 +197,6 @@
             do_nothing=arguments.do_nothing)
 
 if __name__ == "__main__":
-    logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
+    logging.basicConfig(
+        format='%(levelname)s: %(message)s', level=logging.INFO)
     sys.exit(main(sys.argv[1:]))


Follow ups