summaryrefslogtreecommitdiff
path: root/bundler
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2014-09-26 15:36:25 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2014-09-26 16:13:53 -0300
commitcb9c2abb39740757b77eca54f87763818cace546 (patch)
tree7d62f38d661e87d6e611cffefc85a69fd47987f0 /bundler
parent2f0d264a44109341582bc7841367e1925325366d (diff)
Remove --upgrade for pip since causes problems.
The latest bundling scripts breaks if --upgrade is there, I don't know the reason but since we clone the repo each time and install in a clean virtualenv this option shouldn't be necessary. Do some code styling and code refactoring.
Diffstat (limited to 'bundler')
-rw-r--r--bundler/actions.py93
1 files changed, 48 insertions, 45 deletions
diff --git a/bundler/actions.py b/bundler/actions.py
index 4e36b57..3cb4a6b 100644
--- a/bundler/actions.py
+++ b/bundler/actions.py
@@ -2,10 +2,10 @@ import datetime
import hashlib
import os
import stat
-import sys
import subprocess
-import zipfile
+import sys
import urllib
+import zipfile
from abc import ABCMeta, abstractmethod
from contextlib import contextmanager
@@ -78,17 +78,12 @@ def skippable(func):
def platform_dir(basedir, *args):
- dir = os.path.join(basedir,
- "Bitmask",
- *args)
+ dir_ = os.path.join(basedir, "Bitmask", *args)
+
if IS_MAC:
- dir = os.path.join(basedir,
- "Bitmask",
- "Bitmask.app",
- "Contents",
- "MacOS",
- *args)
- return dir
+ dir_ = os.path.join(basedir, "Bitmask", "Bitmask.app",
+ "Contents", "MacOS", *args)
+ return dir_
@contextmanager
@@ -132,15 +127,17 @@ class GitCloneAll(Action):
def run(self, sorted_repos, nightly):
print "Cloning repositories..."
cd(self._basedir)
+
for repo in sorted_repos:
print "Cloning", repo
rm("-rf", repo)
git.clone(self._repo_url(repo), repo)
+
with push_pop(repo):
- # Thandy is a special case regarding branches, we'll just use
- # develop
if repo in ["leap_assets"]:
+ # leap_assets only has 'master'
continue
+
if not nightly:
git.checkout("master")
git.pull("--ff-only", "origin", "master")
@@ -158,41 +155,43 @@ class PythonSetupAll(Action):
def __init__(self, basedir, skip, do):
Action.__init__(self, "pythonsetup", basedir, skip, do)
+ def _build_client(self, repo, binaries_path):
+ print "Running make on the client..."
+ make()
+ print "Running build to get correct version..."
+ python("setup.py", "build")
+ print "Updating hashes"
+ os.environ["OPENVPN_BIN"] = os.path.join(
+ binaries_path, "openvpn.files", "leap-openvpn")
+ os.environ["BITMASK_ROOT"] = os.path.join(
+ self._basedir, repo, "pkg", "linux", "bitmask-root")
+ python("setup.py", "hash_binaries")
+
@skippable
def run(self, sorted_repos, binaries_path):
cd(self._basedir)
for repo in sorted_repos:
+
+ if repo in ["bitmask_launcher", "leap_assets"]:
+ print "Skipping repo: {0}...".format(repo)
+ continue
+
print "Setting up", repo
+
if repo == "soledad":
for subrepo in ["common", "client"]:
with push_pop(repo, subrepo):
- pip("install", "-r", "pkg/requirements.pip", "--upgrade")
+ pip("install", "-r", "pkg/requirements.pip")
python("setup.py", "develop")
sys.path.append(os.path.join(self._basedir,
repo, subrepo, "src"))
- elif repo in ["bitmask_launcher", "leap_assets"]:
- print "Skipping launcher..."
- continue
else:
with push_pop(repo):
- if repo != "thandy":
- pip("install", "-r", "pkg/requirements.pip", "--upgrade")
- else:
- # Thandy is a special kid at this point in
- # terms of packaging. So we install
- # dependencies ourselves for the time being
- pip("install", "pycrypto", "--upgrade")
+ pip("install", "-r", "pkg/requirements.pip")
+
if repo == "bitmask_client":
- print "Running make on the client..."
- make()
- print "Running build to get correct version..."
- python("setup.py", "build")
- print "Updating hashes"
- os.environ["OPENVPN_BIN"] = os.path.join(
- binaries_path, "openvpn.files", "leap-openvpn")
- os.environ["BITMASK_ROOT"] = os.path.join(
- self._basedir, repo, "pkg", "linux", "bitmask-root")
- python("setup.py", "hash_binaries")
+ self._build_client(repo, binaries_path)
+
python("setup.py", "develop")
sys.path.append(os.path.join(self._basedir, repo, "src"))
@@ -354,7 +353,7 @@ class CopyBinaries(Action):
cp(glob(os.path.join(binaries_path, "*.so*")), dest_lib_dir)
eip_dir = platform_dir(self._basedir, "apps", "eip")
- #cp(os.path.join(binaries_path, "openvpn"), eip_dir)
+ # cp(os.path.join(binaries_path, "openvpn"), eip_dir)
cp("-r", glob(os.path.join(binaries_path, "openvpn.files", "*")),
os.path.join(eip_dir, "files"))
@@ -529,12 +528,16 @@ url_prefix = http://dl.bitmask.net/tuf"""
os.path.join(self._basedir,
"bitmask_client", "relnotes.txt")),
_convert_path_for_win(os.path.join(self._basedir, "Bitmask")))
- with open(os.path.join(self._basedir, "Bitmask", "launcher.conf"), "w") as f:
+
+ launcher_path = os.path.join(self._basedir, "Bitmask", "launcher.conf")
+ with open(launcher_path, "w") as f:
f.write(self.TUF_CONFIG)
- mkdir("-p", os.path.join(self._basedir, "Bitmask", "repo", "metadata", "current"))
- mkdir("-p", os.path.join(self._basedir, "Bitmask", "repo", "metadata", "previous"))
+
+ metadata = os.path.join(self._basedir, "Bitmask", "repo", "metadata")
+ mkdir("-p", os.path.join(metadata, "current"))
+ mkdir("-p", os.path.join(metadata, "previous"))
cp(os.path.join(binary_path, "root.json"),
- os.path.join(self._basedir, "Bitmask", "repo", "metadata", "current"))
+ os.path.join(metadata, "current"))
print "Done"
@@ -702,11 +705,11 @@ class SignIt(Action):
main_app = os.path.join(self._basedir,
"Bitmask",
"Bitmask.app")
- print codesign("-s", identity, "--force", "--deep", "--verbose", main_app)
+ print codesign("-s", identity, "--force",
+ "--deep", "--verbose", main_app)
print "Done"
-
class RemoveUnused(Action):
def __init__(self, basedir, skip, do):
Action.__init__(self, "rmunused", basedir, skip, do)
@@ -715,10 +718,10 @@ class RemoveUnused(Action):
def run(self):
print "Removing unused python code..."
test_dirs = find(self._basedir, "-name", "*test*").strip().splitlines()
- for td in test_dirs:
+ for td in test_dirs:
rm("-rf", os.path.join(self._basedir, td))
- twisted_used = ["aplication", "conch", "cred", "version", "internet", "mail"]
+ # twisted_used = ["aplication", "conch", "cred",
+ # "version", "internet", "mail"]
# twisted_files = find(self._basedir, "-name", "t
print "Done"
-