summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changes/feature-5813_wizard-providers-order1
-rw-r--r--changes/feature_package_osx1
-rw-r--r--pkg/osx/Info.plist34
-rw-r--r--pkg/osx/bitmask.icnsbin0 -> 47303 bytes
-rwxr-xr-xsetup.py29
-rw-r--r--src/leap/bitmask/__init__.py6
-rw-r--r--src/leap/bitmask/gui/__init__.py6
-rw-r--r--src/leap/bitmask/gui/wizard.py69
-rw-r--r--src/leap/bitmask/provider/pinned.py10
9 files changed, 119 insertions, 37 deletions
diff --git a/changes/feature-5813_wizard-providers-order b/changes/feature-5813_wizard-providers-order
new file mode 100644
index 00000000..f4033d26
--- /dev/null
+++ b/changes/feature-5813_wizard-providers-order
@@ -0,0 +1 @@
+- Use preferred provider on first run. Closes #5813.
diff --git a/changes/feature_package_osx b/changes/feature_package_osx
new file mode 100644
index 00000000..cf5823bd
--- /dev/null
+++ b/changes/feature_package_osx
@@ -0,0 +1 @@
+- Add the ability to create an osx bundle with py2app. Closes #5845. \ No newline at end of file
diff --git a/pkg/osx/Info.plist b/pkg/osx/Info.plist
index e90d920a..dc427c4a 100644
--- a/pkg/osx/Info.plist
+++ b/pkg/osx/Info.plist
@@ -2,21 +2,23 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
- <key>CFBundleDisplayName</key>
- <string>leap-client</string>
- <key>CFBundleExecutable</key>
- <string>MacOS/app</string>
- <key>CFBundleIconFile</key>
- <string>icon-windowed.icns</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>leap-client</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleShortVersionString</key>
- <string>1</string>
- <key>LSBackgroundOnly</key>
- <false/>
+ <key>CFBundleDisplayName</key>
+ <string>Bitmask</string>
+ <key>CFBundleExecutable</key>
+ <string>app</string>
+ <key>CFBundleIconFile</key>
+ <string>bitmask.icns</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>Bitmask</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1</string>
+ <key>LSBackgroundOnly</key>
+ <false/>
+ <key>CFBundleIdentifier</key>
+ <string>se.leap.bitmask</string>
</dict>
</plist>
diff --git a/pkg/osx/bitmask.icns b/pkg/osx/bitmask.icns
new file mode 100644
index 00000000..7cc3e752
--- /dev/null
+++ b/pkg/osx/bitmask.icns
Binary files differ
diff --git a/setup.py b/setup.py
index bb1937cc..7cd48799 100755
--- a/setup.py
+++ b/setup.py
@@ -253,7 +253,8 @@ cmdclass["sdist"] = cmd_sdist
import platform
_system = platform.system()
-IS_LINUX = True if _system == "Linux" else False
+IS_LINUX = _system == "Linux"
+IS_MAC = _system == "Darwin"
data_files = []
@@ -267,6 +268,31 @@ if IS_LINUX:
["pkg/linux/bitmask-root"]),
]
+extra_options = {}
+
+if IS_MAC:
+ extra_options["app"] = ['src/leap/bitmask/app.py']
+ OPTIONS = {
+ 'argv_emulation': True,
+ 'plist': 'pkg/osx/Info.plist',
+ 'iconfile': 'pkg/osx/bitmask.icns',
+ }
+ extra_options["options"] = {'py2app': OPTIONS}
+ extra_options["setup_requires"] = ['py2app']
+
+ class jsonschema_recipe(object):
+ def check(self, dist, mf):
+ m = mf.findNode('jsonschema')
+ if m is None:
+ return None
+
+ # Don't put jsonschema in the site-packages.zip file
+ return dict(
+ packages=['jsonschema']
+ )
+
+ import py2app.recipes
+ py2app.recipes.jsonschema = jsonschema_recipe()
setup(
name="leap.bitmask",
@@ -305,4 +331,5 @@ setup(
entry_points={
'console_scripts': [leap_launcher]
},
+ **extra_options
)
diff --git a/src/leap/bitmask/__init__.py b/src/leap/bitmask/__init__.py
index 0f733f26..03da1e2f 100644
--- a/src/leap/bitmask/__init__.py
+++ b/src/leap/bitmask/__init__.py
@@ -25,6 +25,12 @@ from pkg_resources import parse_version
from leap.bitmask.util import first
+# 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
+if False:
+ import _scrypt
+
def _is_release_version(version):
"""
diff --git a/src/leap/bitmask/gui/__init__.py b/src/leap/bitmask/gui/__init__.py
index 4b289442..94bf1fd5 100644
--- a/src/leap/bitmask/gui/__init__.py
+++ b/src/leap/bitmask/gui/__init__.py
@@ -17,5 +17,7 @@
"""
init file for leap.gui
"""
-app = __import__("app", globals(), locals(), [], 2)
-__all__ = [app]
+# This was added for coverage and testing, but when doing the osx
+# bundle with py2app it fails because of this, so commenting for now
+# app = __import__("app", globals(), locals(), [], 2)
+# __all__ = [app]
diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py
index f66c553d..4f67958f 100644
--- a/src/leap/bitmask/gui/wizard.py
+++ b/src/leap/bitmask/gui/wizard.py
@@ -83,7 +83,8 @@ class Wizard(QtGui.QWizard):
self.ui.grpCheckProvider.setVisible(False)
self._connect_and_track(self.ui.btnCheck.clicked, self._check_provider)
- self._connect_and_track(self.ui.lnProvider.returnPressed, self._check_provider)
+ self._connect_and_track(self.ui.lnProvider.returnPressed,
+ self._check_provider)
self._backend = backend
self._backend_connect()
@@ -98,22 +99,24 @@ class Wizard(QtGui.QWizard):
self._provider_select_defer = None
self._provider_setup_defer = None
- self._connect_and_track(self.currentIdChanged, self._current_id_changed)
+ self._connect_and_track(self.currentIdChanged,
+ self._current_id_changed)
- self._connect_and_track(self.ui.lnProvider.textChanged, self._enable_check)
+ self._connect_and_track(self.ui.lnProvider.textChanged,
+ self._enable_check)
self._connect_and_track(self.ui.rbNewProvider.toggled,
- lambda x: self._enable_check())
+ lambda x: self._enable_check())
self._connect_and_track(self.ui.cbProviders.currentIndexChanged[int],
- self._reset_provider_check)
+ self._reset_provider_check)
self._connect_and_track(self.ui.lblUser.returnPressed,
- self._focus_password)
+ self._focus_password)
self._connect_and_track(self.ui.lblPassword.returnPressed,
- self._focus_second_password)
+ self._focus_second_password)
self._connect_and_track(self.ui.lblPassword2.returnPressed,
- self._register)
+ self._register)
self._connect_and_track(self.ui.btnRegister.clicked,
- self._register)
+ self._register)
self._connect_and_track(self.ui.rbExistingProvider.toggled,
self._skip_provider_checks)
@@ -184,21 +187,55 @@ class Wizard(QtGui.QWizard):
:param pinned: list of pinned providers
:type pinned: list of str
+
+
+ How the combobox items are arranged:
+ -----------------------------------
+
+ First run:
+
+ demo.bitmask.net
+ --
+ pinned2.org
+ pinned1.org
+ pinned3.org
+
+ After some usage:
+
+ added-by-user.org
+ pinned-but-then-used.org
+ ---
+ demo.bitmask.net
+ pinned1.org
+ pinned3.org
+ pinned2.org
+
+ In other words:
+ * There are two sections.
+ * Section one consists of all the providers that the user has used.
+ If this is empty, than use demo.bitmask.net for this section.
+ This list is sorted alphabetically.
+ * Section two consists of all the pinned or 'pre seeded' providers,
+ minus any providers that are now in section one. This last list
+ is in random order.
"""
ls = LeapSettings()
- providers = ls.get_configured_providers()
- if not providers and not pinned:
+ user_added = ls.get_configured_providers()
+ if not user_added and not pinned:
self.ui.rbExistingProvider.setEnabled(False)
self.ui.label_8.setEnabled(False) # 'https://' label
self.ui.cbProviders.setEnabled(False)
return
- user_added = []
+ user_added.sort()
+
+ if not user_added:
+ user_added = [pinned.pop(0)]
- # separate pinned providers from user added ones
- for p in providers:
- if p not in pinned:
- user_added.append(p)
+ # separate unused pinned providers from user added ones
+ for p in user_added:
+ if p in pinned:
+ pinned.remove(p)
if user_added:
self.ui.cbProviders.addItems(user_added)
diff --git a/src/leap/bitmask/provider/pinned.py b/src/leap/bitmask/provider/pinned.py
index 38851621..6fd2fa70 100644
--- a/src/leap/bitmask/provider/pinned.py
+++ b/src/leap/bitmask/provider/pinned.py
@@ -32,6 +32,7 @@ class PinnedProviders(object):
CONFIG_KEY = "config"
CACERT_KEY = "cacert"
+ PREFERRED_PROVIDER = pinned_demobitmask.DOMAIN
PROVIDERS = {
pinned_demobitmask.DOMAIN: {
@@ -50,11 +51,16 @@ class PinnedProviders(object):
@classmethod
def domains(self):
"""
- Return the domains that are pinned in here
+ Return the domains that are pinned in here.
+ The first domain in the list is the preferred one.
:rtype: list of str
"""
- return self.PROVIDERS.keys()
+ domains = self.PROVIDERS.keys()
+ domains.remove(self.PREFERRED_PROVIDER)
+ domains.insert(0, self.PREFERRED_PROVIDER)
+
+ return domains
@classmethod
def save_hardcoded(self, domain, provider_path, cacert_path):