← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad-buildd:refactor-proxy into launchpad-buildd:master

 

Colin Watson has proposed merging ~cjwatson/launchpad-buildd:refactor-proxy into launchpad-buildd:master.

Commit message:
Move some initialization into BuilderProxyOperationMixin

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-buildd/+git/launchpad-buildd/+merge/413129

`self.bin` is only used by `BuilderProxyOperationMixin.install_git_proxy`, so it makes sense to initialize that in the mixin's constructor.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad-buildd:refactor-proxy into launchpad-buildd:master.
diff --git a/lpbuildd/target/build_charm.py b/lpbuildd/target/build_charm.py
index 5d0b3ab..6ca49d9 100644
--- a/lpbuildd/target/build_charm.py
+++ b/lpbuildd/target/build_charm.py
@@ -8,7 +8,6 @@ __metaclass__ = type
 from collections import OrderedDict
 import logging
 import os
-import sys
 
 from lpbuildd.target.backend import check_path_escape
 from lpbuildd.target.build_snap import SnapChannelsAction
@@ -48,7 +47,6 @@ class BuildCharm(BuilderProxyOperationMixin, VCSOperationMixin,
 
     def __init__(self, args, parser):
         super(BuildCharm, self).__init__(args, parser)
-        self.bin = os.path.dirname(sys.argv[0])
         self.buildd_path = os.path.join("/home/buildd", self.args.name)
 
     def run_build_command(self, args, env=None, **kwargs):
diff --git a/lpbuildd/target/build_oci.py b/lpbuildd/target/build_oci.py
index 7f2a9ed..e328698 100644
--- a/lpbuildd/target/build_oci.py
+++ b/lpbuildd/target/build_oci.py
@@ -8,7 +8,6 @@ __metaclass__ = type
 from collections import OrderedDict
 import logging
 import os.path
-import sys
 import tempfile
 from textwrap import dedent
 
@@ -48,7 +47,6 @@ class BuildOCI(BuilderProxyOperationMixin, VCSOperationMixin,
 
     def __init__(self, args, parser):
         super(BuildOCI, self).__init__(args, parser)
-        self.bin = os.path.dirname(sys.argv[0])
         self.buildd_path = os.path.join("/home/buildd", self.args.name)
 
     def _add_docker_engine_proxy_settings(self):
diff --git a/lpbuildd/target/build_snap.py b/lpbuildd/target/build_snap.py
index 7ec133b..b7cd1ea 100644
--- a/lpbuildd/target/build_snap.py
+++ b/lpbuildd/target/build_snap.py
@@ -10,7 +10,6 @@ from collections import OrderedDict
 import json
 import logging
 import os.path
-import sys
 import tempfile
 from textwrap import dedent
 
@@ -81,10 +80,6 @@ class BuildSnap(BuilderProxyOperationMixin, VCSOperationMixin,
             help="build a private snap")
         parser.add_argument("name", help="name of snap to build")
 
-    def __init__(self, args, parser):
-        super(BuildSnap, self).__init__(args, parser)
-        self.bin = os.path.dirname(sys.argv[0])
-
     def run_build_command(self, args, env=None, **kwargs):
         """Run a build command in the target.
 
diff --git a/lpbuildd/target/proxy.py b/lpbuildd/target/proxy.py
index 4835c78..57d34fd 100644
--- a/lpbuildd/target/proxy.py
+++ b/lpbuildd/target/proxy.py
@@ -7,11 +7,16 @@ __metaclass__ = type
 
 from collections import OrderedDict
 import os
+import sys
 
 
 class BuilderProxyOperationMixin:
     """Methods supporting the build time HTTP proxy for certain build types."""
 
+    def __init__(self, args, parser):
+        super(BuilderProxyOperationMixin, self).__init__(args, parser)
+        self.bin = os.path.dirname(sys.argv[0])
+
     @classmethod
     def add_arguments(cls, parser):
         super(BuilderProxyOperationMixin, cls).add_arguments(parser)