summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsetup.py39
-rw-r--r--src/leap/bitmask/__init__.py3
-rw-r--r--src/leap/bitmask/app.py20
-rw-r--r--src/leap/bitmask/config/leapsettings.py1
-rw-r--r--src/leap/bitmask/util/keyring_helpers.py5
-rw-r--r--src/leap/bitmask/util/pastebin.py4
6 files changed, 37 insertions, 35 deletions
diff --git a/setup.py b/setup.py
index 5bf5d186..62e9b115 100755
--- a/setup.py
+++ b/setup.py
@@ -20,37 +20,43 @@ Setup file for bitmask.
"""
from __future__ import print_function
+import glob
import hashlib
-import sys
import os
+import platform
import re
+import shutil
+import sys
from distutils.command.build import build as _build
from setuptools import Command
+from setuptools.command.develop import develop as _develop
-if not sys.version_info[0] == 2:
- print("[ERROR] Sorry, Python 3 is not supported (yet). "
- "Try running with python2: python2 setup.py ...")
- exit()
-
-try:
- from setuptools import setup, find_packages
-except ImportError:
- from pkg import distribute_setup
- distribute_setup.use_setuptools()
- from setuptools import setup, find_packages
from pkg import utils
import versioneer
-
# The following import avoids the premature unloading of the `util` submodule
# when running tests, which would cause an error when nose finishes tests and
# calls the exit function of the multiprocessing module.
from multiprocessing import util
assert(util)
+
+try:
+ from setuptools import setup, find_packages
+except ImportError:
+ from pkg import distribute_setup
+ distribute_setup.use_setuptools()
+ from setuptools import setup, find_packages
+
+if not sys.version_info[0] == 2:
+ print("[ERROR] Sorry, Python 3 is not supported (yet). "
+ "Try running with python2: python2 setup.py ...")
+ exit()
+
+
setup_root = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(setup_root, "src"))
@@ -167,8 +173,6 @@ else:
leap_launcher = 'bitmask=leap.bitmask.app:start_app'
-from setuptools.command.develop import develop as _develop
-
def copy_reqs(path, withsrc=False):
# add a copy of the processed requirements to the package
@@ -365,10 +369,6 @@ class cmd_sdist(versioneer_sdist):
pass
-import shutil
-import glob
-
-
def _get_leap_versions():
versions = {}
with open("pkg/leap_versions.txt") as vf:
@@ -457,7 +457,6 @@ def copy_recursively(source_folder, destination_folder):
cmdclass["build"] = cmd_build
cmdclass["sdist"] = cmd_sdist
-import platform
_system = platform.system()
IS_LINUX = _system == "Linux"
IS_MAC = _system == "Darwin"
diff --git a/src/leap/bitmask/__init__.py b/src/leap/bitmask/__init__.py
index 6ab55e53..c25ae999 100644
--- a/src/leap/bitmask/__init__.py
+++ b/src/leap/bitmask/__init__.py
@@ -19,6 +19,8 @@ Init file for leap.bitmask
Initializes version and app info.
"""
+from ._version import get_versions
+
# HACK: This is a hack so that py2app copies _scrypt.so to the right
# place, it can't be technically imported, but that doesn't matter
# because the import is never executed
@@ -45,7 +47,6 @@ def _is_release_version(version_str):
return patch.isdigit()
-from ._version import get_versions
__version__ = get_versions()['version']
__version_hash__ = get_versions()['full-revisionid']
IS_RELEASE_VERSION = _is_release_version(__version__)
diff --git a/src/leap/bitmask/app.py b/src/leap/bitmask/app.py
index 0c4c32e2..0ae60e48 100644
--- a/src/leap/bitmask/app.py
+++ b/src/leap/bitmask/app.py
@@ -46,11 +46,7 @@ import os
import platform
import sys
-if platform.system() == "Darwin":
- # We need to tune maximum number of files, due to zmq usage
- # we hit the limit.
- import resource
- resource.setrlimit(resource.RLIMIT_NOFILE, (4096, 10240))
+import psutil
from leap.bitmask import __version__ as VERSION
from leap.bitmask.backend.backend_proxy import BackendProxy
@@ -70,7 +66,12 @@ from leap.mail import __version__ as MAIL_VERSION
import codecs
codecs.register(lambda name: codecs.lookup('utf-8')
if name == 'cp65001' else None)
-import psutil
+
+if platform.system() == "Darwin":
+ # We need to tune maximum number of files, due to zmq usage
+ # we hit the limit.
+ import resource
+ resource.setrlimit(resource.RLIMIT_NOFILE, (4096, 10240))
def kill_the_children():
@@ -226,9 +227,10 @@ def start_app():
backend_pid = None
if not backend_running:
frontend_pid = os.getpid()
- backend_process = multiprocessing.Process(target=run_backend,
- name='Backend',
- args=(opts.danger, flags_dict, frontend_pid))
+ backend_process = multiprocessing.Process(
+ target=run_backend,
+ name='Backend',
+ args=(opts.danger, flags_dict, frontend_pid))
# we don't set the 'daemon mode' since we need to start child processes
# in the backend
# backend_process.daemon = True
diff --git a/src/leap/bitmask/config/leapsettings.py b/src/leap/bitmask/config/leapsettings.py
index d7590c24..01900484 100644
--- a/src/leap/bitmask/config/leapsettings.py
+++ b/src/leap/bitmask/config/leapsettings.py
@@ -361,4 +361,3 @@ class LeapSettings(object):
def set_pixelmail_enabled(self, enabled):
leap_assert_type(enabled, bool)
self._settings.setvalue(self.PIXELMAIL_KEY, enabled)
-
diff --git a/src/leap/bitmask/util/keyring_helpers.py b/src/leap/bitmask/util/keyring_helpers.py
index d81f39b1..c5181348 100644
--- a/src/leap/bitmask/util/keyring_helpers.py
+++ b/src/leap/bitmask/util/keyring_helpers.py
@@ -24,8 +24,9 @@ try:
EncryptedKeyring,
PlaintextKeyring
]
- canuse = lambda kr: (kr is not None
- and kr.__class__ not in OBSOLETE_KEYRINGS)
+ canuse = lambda kr: (
+ kr is not None and
+ kr.__class__ not in OBSOLETE_KEYRINGS)
except Exception:
# Problems when importing keyring! It might be a problem binding to the
diff --git a/src/leap/bitmask/util/pastebin.py b/src/leap/bitmask/util/pastebin.py
index 6d50ac9e..b476ad88 100644
--- a/src/leap/bitmask/util/pastebin.py
+++ b/src/leap/bitmask/util/pastebin.py
@@ -25,13 +25,13 @@
#############################################################################
+import urllib
+
__ALL__ = ['delete_paste', 'user_details', 'trending', 'pastes_by_user',
'generate_user_key', 'paste', 'Pastebin', 'PastebinError',
'PostLimitError']
-import urllib
-
class PastebinError(RuntimeError):
"""Pastebin API error.