diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/branding/__init__.py | 15 | ||||
-rw-r--r-- | pkg/branding/config.py | 11 | ||||
-rw-r--r-- | pkg/dev-reqs.pip | 4 | ||||
-rw-r--r-- | pkg/distribute_setup.py | 515 | ||||
-rwxr-xr-x | pkg/install_pyqt.sh | 10 | ||||
-rw-r--r-- | pkg/install_venv.py | 4 | ||||
-rw-r--r-- | pkg/osx/Makefile | 25 | ||||
-rw-r--r-- | pkg/osx/README.rst | 28 | ||||
-rwxr-xr-x | pkg/osx/build_tuntaposx | 45 | ||||
-rw-r--r-- | pkg/osx/install/ProcessNetworkChanges.plist.template | 2 | ||||
-rwxr-xr-x | pkg/osx/install/client.down.sh | 34 | ||||
-rwxr-xr-x | pkg/osx/install/client.up.sh | 29 | ||||
-rwxr-xr-x | pkg/osx/install/install-leapc.sh | 43 | ||||
-rw-r--r-- | pkg/osx/install/tun.kext/Info.plist | 36 | ||||
-rw-r--r-- | pkg/osx/leap-client.spec | 6 | ||||
m--------- | pkg/osx/tuntaposx | 0 | ||||
-rwxr-xr-x | pkg/postmkvenv.sh | 8 | ||||
-rw-r--r-- | pkg/requirements-dev.pip | 17 | ||||
-rw-r--r-- | pkg/requirements-testing.pip | 18 | ||||
-rw-r--r-- | pkg/requirements.pip | 32 | ||||
-rw-r--r-- | pkg/scripts/leap_client_bootstrap.sh | 2 | ||||
-rw-r--r-- | pkg/test-requirements.pip | 8 | ||||
-rw-r--r-- | pkg/utils.py | 52 | ||||
-rw-r--r-- | pkg/windows/openvpn_manifest | 19 |
24 files changed, 308 insertions, 655 deletions
diff --git a/pkg/branding/__init__.py b/pkg/branding/__init__.py deleted file mode 100644 index 0bd6befb..00000000 --- a/pkg/branding/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -from .config import APP_BASE_NAME, APP_PREFIX, BRANDED_BUILD, BRANDED_OPTS - - -def get_name(): - if BRANDED_BUILD is True: - return APP_PREFIX + BRANDED_OPTS.get('short_name', 'name_unknown') - else: - return APP_BASE_NAME - - -def get_shortname(): - if BRANDED_BUILD is True: - return BRANDED_OPTS.get('short_name', 'name_unknown') - -__all__ = ['get_name'] diff --git a/pkg/branding/config.py b/pkg/branding/config.py deleted file mode 100644 index bcacc3bc..00000000 --- a/pkg/branding/config.py +++ /dev/null @@ -1,11 +0,0 @@ -# Configuration file for branding - -BRANDED_BUILD = False - -APP_BASE_NAME = "leap-client" -APP_PREFIX = "%s-" % APP_BASE_NAME - -BRANDED_OPTS = { - 'short_name': "", - 'provider_domain': "", - 'provider_ca_path': ""} diff --git a/pkg/dev-reqs.pip b/pkg/dev-reqs.pip deleted file mode 100644 index 44799a26..00000000 --- a/pkg/dev-reqs.pip +++ /dev/null @@ -1,4 +0,0 @@ -ipython -ipdb -pdb4qt -pygeoip diff --git a/pkg/distribute_setup.py b/pkg/distribute_setup.py deleted file mode 100644 index 8f5b0637..00000000 --- a/pkg/distribute_setup.py +++ /dev/null @@ -1,515 +0,0 @@ -#!python -"""Bootstrap distribute installation - -If you want to use setuptools in your package's setup.py, just include this -file in the same directory with it, and add this to the top of your setup.py:: - - from distribute_setup import use_setuptools - use_setuptools() - -If you want to require a specific version of setuptools, set a download -mirror, or use an alternate download directory, you can do so by supplying -the appropriate options to ``use_setuptools()``. - -This file can also be run as a script to install or upgrade setuptools. -""" -import os -import sys -import time -import fnmatch -import tempfile -import tarfile -from distutils import log - -try: - from site import USER_SITE -except ImportError: - USER_SITE = None - -try: - import subprocess - - def _python_cmd(*args): - args = (sys.executable,) + args - return subprocess.call(args) == 0 - -except ImportError: - # will be used for python 2.3 - def _python_cmd(*args): - args = (sys.executable,) + args - # quoting arguments if windows - if sys.platform == 'win32': - def quote(arg): - if ' ' in arg: - return '"%s"' % arg - return arg - args = [quote(arg) for arg in args] - return os.spawnl(os.P_WAIT, sys.executable, *args) == 0 - -DEFAULT_VERSION = "0.6.28" -DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/" -SETUPTOOLS_FAKED_VERSION = "0.6c11" - -SETUPTOOLS_PKG_INFO = """\ -Metadata-Version: 1.0 -Name: setuptools -Version: %s -Summary: xxxx -Home-page: xxx -Author: xxx -Author-email: xxx -License: xxx -Description: xxx -""" % SETUPTOOLS_FAKED_VERSION - - -def _install(tarball, install_args=()): - # extracting the tarball - tmpdir = tempfile.mkdtemp() - log.warn('Extracting in %s', tmpdir) - old_wd = os.getcwd() - try: - os.chdir(tmpdir) - tar = tarfile.open(tarball) - _extractall(tar) - tar.close() - - # going in the directory - subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0]) - os.chdir(subdir) - log.warn('Now working in %s', subdir) - - # installing - log.warn('Installing Distribute') - if not _python_cmd('setup.py', 'install', *install_args): - log.warn('Something went wrong during the installation.') - log.warn('See the error message above.') - finally: - os.chdir(old_wd) - - -def _build_egg(egg, tarball, to_dir): - # extracting the tarball - tmpdir = tempfile.mkdtemp() - log.warn('Extracting in %s', tmpdir) - old_wd = os.getcwd() - try: - os.chdir(tmpdir) - tar = tarfile.open(tarball) - _extractall(tar) - tar.close() - - # going in the directory - subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0]) - os.chdir(subdir) - log.warn('Now working in %s', subdir) - - # building an egg - log.warn('Building a Distribute egg in %s', to_dir) - _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir) - - finally: - os.chdir(old_wd) - # returning the result - log.warn(egg) - if not os.path.exists(egg): - raise IOError('Could not build the egg.') - - -def _do_download(version, download_base, to_dir, download_delay): - egg = os.path.join(to_dir, 'distribute-%s-py%d.%d.egg' - % (version, sys.version_info[0], sys.version_info[1])) - if not os.path.exists(egg): - tarball = download_setuptools(version, download_base, - to_dir, download_delay) - _build_egg(egg, tarball, to_dir) - sys.path.insert(0, egg) - import setuptools - setuptools.bootstrap_install_from = egg - - -def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, - to_dir=os.curdir, download_delay=15, no_fake=True): - # making sure we use the absolute path - to_dir = os.path.abspath(to_dir) - was_imported = 'pkg_resources' in sys.modules or \ - 'setuptools' in sys.modules - try: - try: - import pkg_resources - if not hasattr(pkg_resources, '_distribute'): - if not no_fake: - _fake_setuptools() - raise ImportError - except ImportError: - return _do_download(version, download_base, to_dir, download_delay) - try: - pkg_resources.require("distribute>=" + version) - return - except pkg_resources.VersionConflict: - e = sys.exc_info()[1] - if was_imported: - sys.stderr.write( - "The required version of distribute (>=%s) is not available,\n" - "and can't be installed while this script is running. Please\n" - "install a more recent version first, using\n" - "'easy_install -U distribute'." - "\n\n(Currently using %r)\n" % (version, e.args[0])) - sys.exit(2) - else: - del pkg_resources, sys.modules['pkg_resources'] # reload ok - return _do_download(version, download_base, to_dir, - download_delay) - except pkg_resources.DistributionNotFound: - return _do_download(version, download_base, to_dir, - download_delay) - finally: - if not no_fake: - _create_fake_setuptools_pkg_info(to_dir) - - -def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, - to_dir=os.curdir, delay=15): - """Download distribute from a specified location and return its filename - - `version` should be a valid distribute version number that is available - as an egg for download under the `download_base` URL (which should end - with a '/'). `to_dir` is the directory where the egg will be downloaded. - `delay` is the number of seconds to pause before an actual download - attempt. - """ - # making sure we use the absolute path - to_dir = os.path.abspath(to_dir) - try: - from urllib.request import urlopen - except ImportError: - from urllib2 import urlopen - tgz_name = "distribute-%s.tar.gz" % version - url = download_base + tgz_name - saveto = os.path.join(to_dir, tgz_name) - src = dst = None - if not os.path.exists(saveto): # Avoid repeated downloads - try: - log.warn("Downloading %s", url) - src = urlopen(url) - # Read/write all in one block, so we don't create a corrupt file - # if the download is interrupted. - data = src.read() - dst = open(saveto, "wb") - dst.write(data) - finally: - if src: - src.close() - if dst: - dst.close() - return os.path.realpath(saveto) - - -def _no_sandbox(function): - def __no_sandbox(*args, **kw): - try: - from setuptools.sandbox import DirectorySandbox - if not hasattr(DirectorySandbox, '_old'): - def violation(*args): - pass - DirectorySandbox._old = DirectorySandbox._violation - DirectorySandbox._violation = violation - patched = True - else: - patched = False - except ImportError: - patched = False - - try: - return function(*args, **kw) - finally: - if patched: - DirectorySandbox._violation = DirectorySandbox._old - del DirectorySandbox._old - - return __no_sandbox - - -def _patch_file(path, content): - """Will backup the file then patch it""" - existing_content = open(path).read() - if existing_content == content: - # already patched - log.warn('Already patched.') - return False - log.warn('Patching...') - _rename_path(path) - f = open(path, 'w') - try: - f.write(content) - finally: - f.close() - return True - -_patch_file = _no_sandbox(_patch_file) - - -def _same_content(path, content): - return open(path).read() == content - - -def _rename_path(path): - new_name = path + '.OLD.%s' % time.time() - log.warn('Renaming %s into %s', path, new_name) - os.rename(path, new_name) - return new_name - - -def _remove_flat_installation(placeholder): - if not os.path.isdir(placeholder): - log.warn('Unkown installation at %s', placeholder) - return False - found = False - for file in os.listdir(placeholder): - if fnmatch.fnmatch(file, 'setuptools*.egg-info'): - found = True - break - if not found: - log.warn('Could not locate setuptools*.egg-info') - return - - log.warn('Removing elements out of the way...') - pkg_info = os.path.join(placeholder, file) - if os.path.isdir(pkg_info): - patched = _patch_egg_dir(pkg_info) - else: - patched = _patch_file(pkg_info, SETUPTOOLS_PKG_INFO) - - if not patched: - log.warn('%s already patched.', pkg_info) - return False - # now let's move the files out of the way - for element in ('setuptools', 'pkg_resources.py', 'site.py'): - element = os.path.join(placeholder, element) - if os.path.exists(element): - _rename_path(element) - else: - log.warn('Could not find the %s element of the ' - 'Setuptools distribution', element) - return True - -_remove_flat_installation = _no_sandbox(_remove_flat_installation) - - -def _after_install(dist): - log.warn('After install bootstrap.') - placeholder = dist.get_command_obj('install').install_purelib - _create_fake_setuptools_pkg_info(placeholder) - - -def _create_fake_setuptools_pkg_info(placeholder): - if not placeholder or not os.path.exists(placeholder): - log.warn('Could not find the install location') - return - pyver = '%s.%s' % (sys.version_info[0], sys.version_info[1]) - setuptools_file = 'setuptools-%s-py%s.egg-info' % \ - (SETUPTOOLS_FAKED_VERSION, pyver) - pkg_info = os.path.join(placeholder, setuptools_file) - if os.path.exists(pkg_info): - log.warn('%s already exists', pkg_info) - return - - if not os.access(pkg_info, os.W_OK): - log.warn("Don't have permissions to write %s, skipping", pkg_info) - - log.warn('Creating %s', pkg_info) - f = open(pkg_info, 'w') - try: - f.write(SETUPTOOLS_PKG_INFO) - finally: - f.close() - - pth_file = os.path.join(placeholder, 'setuptools.pth') - log.warn('Creating %s', pth_file) - f = open(pth_file, 'w') - try: - f.write(os.path.join(os.curdir, setuptools_file)) - finally: - f.close() - -_create_fake_setuptools_pkg_info = _no_sandbox( - _create_fake_setuptools_pkg_info -) - - -def _patch_egg_dir(path): - # let's check if it's already patched - pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO') - if os.path.exists(pkg_info): - if _same_content(pkg_info, SETUPTOOLS_PKG_INFO): - log.warn('%s already patched.', pkg_info) - return False - _rename_path(path) - os.mkdir(path) - os.mkdir(os.path.join(path, 'EGG-INFO')) - pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO') - f = open(pkg_info, 'w') - try: - f.write(SETUPTOOLS_PKG_INFO) - finally: - f.close() - return True - -_patch_egg_dir = _no_sandbox(_patch_egg_dir) - - -def _before_install(): - log.warn('Before install bootstrap.') - _fake_setuptools() - - -def _under_prefix(location): - if 'install' not in sys.argv: - return True - args = sys.argv[sys.argv.index('install') + 1:] - for index, arg in enumerate(args): - for option in ('--root', '--prefix'): - if arg.startswith('%s=' % option): - top_dir = arg.split('root=')[-1] - return location.startswith(top_dir) - elif arg == option: - if len(args) > index: - top_dir = args[index + 1] - return location.startswith(top_dir) - if arg == '--user' and USER_SITE is not None: - return location.startswith(USER_SITE) - return True - - -def _fake_setuptools(): - log.warn('Scanning installed packages') - try: - import pkg_resources - except ImportError: - # we're cool - log.warn('Setuptools or Distribute does not seem to be installed.') - return - ws = pkg_resources.working_set - try: - setuptools_dist = ws.find( - pkg_resources.Requirement.parse('setuptools', replacement=False) - ) - except TypeError: - # old distribute API - setuptools_dist = ws.find( - pkg_resources.Requirement.parse('setuptools') - ) - - if setuptools_dist is None: - log.warn('No setuptools distribution found') - return - # detecting if it was already faked - setuptools_location = setuptools_dist.location - log.warn('Setuptools installation detected at %s', setuptools_location) - - # if --root or --preix was provided, and if - # setuptools is not located in them, we don't patch it - if not _under_prefix(setuptools_location): - log.warn('Not patching, --root or --prefix is installing Distribute' - ' in another location') - return - - # let's see if its an egg - if not setuptools_location.endswith('.egg'): - log.warn('Non-egg installation') - res = _remove_flat_installation(setuptools_location) - if not res: - return - else: - log.warn('Egg installation') - pkg_info = os.path.join(setuptools_location, 'EGG-INFO', 'PKG-INFO') - if (os.path.exists(pkg_info) and - _same_content(pkg_info, SETUPTOOLS_PKG_INFO)): - log.warn('Already patched.') - return - log.warn('Patching...') - # let's create a fake egg replacing setuptools one - res = _patch_egg_dir(setuptools_location) - if not res: - return - log.warn('Patched done.') - _relaunch() - - -def _relaunch(): - log.warn('Relaunching...') - # we have to relaunch the process - # pip marker to avoid a relaunch bug - _cmd = ['-c', 'install', '--single-version-externally-managed'] - if sys.argv[:3] == _cmd: - sys.argv[0] = 'setup.py' - args = [sys.executable] + sys.argv - sys.exit(subprocess.call(args)) - - -def _extractall(self, path=".", members=None): - """Extract all members from the archive to the current working - directory and set owner, modification time and permissions on - directories afterwards. `path' specifies a different directory - to extract to. `members' is optional and must be a subset of the - list returned by getmembers(). - """ - import copy - import operator - from tarfile import ExtractError - directories = [] - - if members is None: - members = self - - for tarinfo in members: - if tarinfo.isdir(): - # Extract directories with a safe mode. - directories.append(tarinfo) - tarinfo = copy.copy(tarinfo) - tarinfo.mode = 448 # decimal for oct 0700 - self.extract(tarinfo, path) - - # Reverse sort directories. - if sys.version_info < (2, 4): - def sorter(dir1, dir2): - return cmp(dir1.name, dir2.name) - directories.sort(sorter) - directories.reverse() - else: - directories.sort(key=operator.attrgetter('name'), reverse=True) - - # Set correct owner, mtime and filemode on directories. - for tarinfo in directories: - dirpath = os.path.join(path, tarinfo.name) - try: - self.chown(tarinfo, dirpath) - self.utime(tarinfo, dirpath) - self.chmod(tarinfo, dirpath) - except ExtractError: - e = sys.exc_info()[1] - if self.errorlevel > 1: - raise - else: - self._dbg(1, "tarfile: %s" % e) - - -def _build_install_args(argv): - install_args = [] - user_install = '--user' in argv - if user_install and sys.version_info < (2, 6): - log.warn("--user requires Python 2.6 or later") - raise SystemExit(1) - if user_install: - install_args.append('--user') - return install_args - - -def main(argv, version=DEFAULT_VERSION): - """Install or upgrade setuptools and EasyInstall""" - tarball = download_setuptools() - _install(tarball, _build_install_args(argv)) - - -if __name__ == '__main__': - main(sys.argv[1:]) diff --git a/pkg/install_pyqt.sh b/pkg/install_pyqt.sh deleted file mode 100755 index d6739816..00000000 --- a/pkg/install_pyqt.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -pip install sip # fails -cd build/sip -python configure.py -make && make install -cd ../.. -pip install PyQt # fails -cd build/PyQt -python configure.py -make && make install diff --git a/pkg/install_venv.py b/pkg/install_venv.py index 17dfb984..80bc5d4b 100644 --- a/pkg/install_venv.py +++ b/pkg/install_venv.py @@ -30,7 +30,7 @@ import sys ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) VENV = os.path.join(ROOT, '.venv') PIP_REQUIRES = os.path.join(ROOT, 'pkg', 'requirements.pip') -TEST_REQUIRES = os.path.join(ROOT, 'pkg', 'test-requirements.pip') +TEST_REQUIRES = os.path.join(ROOT, 'pkg', 'requirements-testing.pip') PY_VERSION = "python%s.%s" % (sys.version_info[0], sys.version_info[1]) @@ -167,7 +167,7 @@ def create_virtualenv(venv=VENV, no_site_packages=True): """ print 'Creating venv...', if no_site_packages: - #setuptools and virtualenv don't play nicely together, + #setuptools and virtualenv don't play nicely together, #so we create the virtualenv with the distribute package instead. #See: view-source:http://pypi.python.org/pypi/distribute run_command(['virtualenv', '-q', '--distribute', '--no-site-packages', VENV]) diff --git a/pkg/osx/Makefile b/pkg/osx/Makefile index f2520fcf..15dfb810 100644 --- a/pkg/osx/Makefile +++ b/pkg/osx/Makefile @@ -1,12 +1,10 @@ -#WARNING: You need to run this with an activated VIRTUALENV. - OSX = dist/LEAP\ Client.app/Contents/MacOS/ GITC = `git rev-parse --short HEAD` DMG = "dist/leap-client-$(GITC).dmg" INST = "dist/LEAP Client installer.app" INSTR = "dist/LEAP Client installer.app/Contents/Resources" -pkg : dist trim installer dmg +pkg : check-env dist tuntap installer dmg dist : ~/pyinstaller/pyinstaller.py -w -s leap-client.spec @@ -16,20 +14,22 @@ dist : trim: #XXX this should go properly in pyinstaller spec excludes, but going quick'n'dirty + #XXX adapt to PySide rm $(OSX)QtSvg $(OSX)QtXml $(OSX)QtNetwork $(OSX)QtOpenGL $(OSX)Qt3Support $(OSX)QtSql +tuntap: + ./build_tuntaposx clean && ./build_tuntaposx + installer: #XXX need to fix some paths there (binary, etc) platypus -P install/leap-installer.platypus -y $(INST) - #XXX should build tuntap extensions ourselves + # build tuntaposx kernel extension mkdir $(INSTR)/StartupItems mkdir $(INSTR)/Extensions - cp -r /opt/local/Library/StartupItems/tun $(INSTR)/StartupItems - cp -r /opt/local/Library/StartupItems/tap $(INSTR)/StartupItems - cp -r /opt/local/Library/Extensions/tun.kext $(INSTR)/Extensions - cp -r /opt/local/Library/Extensions/tap.kext $(INSTR)/Extensions - #copy the binary that we have previously built - #XXX not building it yet... + cp -r dist/tun.kext $(INSTR)/Extensions + cp -r dist/tuntaposx/StartupItems/* $(INSTR)/StartupItems + cp install/tun.kext/Info.plist $(INSTR)/Extensions/tun.kext/Contents/ + #copy the binary that we have previously built (not yet) cp ../../openvpn/build/openvpn.leap $(INSTR) #copy startup scripts cp install/client.up.sh $(INSTR) @@ -42,5 +42,10 @@ dmg : rm -f $(DMG) hdiutil create -format UDBZ -srcfolder $(INST) $(DMG) +check-env: +ifndef VIRTUAL_ENV + $(error WHAT DO YOU THINK VIRTUALENV IS FOR??!! Please go get into one..) +endif + clean : rm -rf dist/ build/ diff --git a/pkg/osx/README.rst b/pkg/osx/README.rst index 48d96ffb..03aac4f2 100644 --- a/pkg/osx/README.rst +++ b/pkg/osx/README.rst @@ -9,37 +9,29 @@ basically you need this to setup your environment: # install xcode and macports # port -v selfupdate # port install python26 -# port install python_select # unneeded? +# port install python_select +# port select python python26 # port install py26-pyqt4 -# port install py26-twisted # port install py26-pip # port install py26-virtualenv # port install git-core -# port install gnutls # port install platypus +# port install upx Requirements ============ -pyinstaller (in ~/pyinstaller) +pyinstaller +----------- +Expected in ~/pyinstaller + +You need the development version. +Tested with: 2.0.373 + platypus (tested with latest macports) ... + install environment as usual, inside virtualenv. -.. note:: there is something missing here, about troubles building gnutls extension, - I think I ended by symlinking global install via macports. - -Pyinstaller fix for sip api ---------------------------- -We need a workaround for setting the right sip api. -Paste this in the top of pyinstaller/support/rthooks/pyi_rth_qt4plugins.py:: - - import sip - sip.setapi('QString', 2) - sip.setapi('QVariant', 2) - -See www.pyinstaller.org/wiki/Recipe/PyQtChangeApiVersion. - Building the package ==================== diff --git a/pkg/osx/build_tuntaposx b/pkg/osx/build_tuntaposx new file mode 100755 index 00000000..10bb7c9c --- /dev/null +++ b/pkg/osx/build_tuntaposx @@ -0,0 +1,45 @@ +#!/bin/zsh +# +# Copyright (C) 2012 ... +# + +REPO="https://github.com/bbits/tuntaposx.git" + +autoload colors; colors +# standard output message routines +# it's always useful to wrap them, in case we change behaviour later +notice() { if [[ $QUIET == 0 ]]; then print "$fg_bold[green][*]$fg_no_bold[default] $1" >&2; fi } +error() { if [[ $QUIET == 0 ]]; then print "$fg[red][!]$fg[default] $1" >&2; fi } +func() { if [[ $DEBUG == 1 ]]; then print "$fg[blue][D]$fg[default] $1" >&2; fi } +act() { + if [[ $QUIET == 0 ]]; then + if [ "$1" = "-n" ]; then + print -n "$fg_bold[white] . $fg_no_bold[default] $2" >&2; + else + print "$fg_bold[white] . $fg_no_bold[default] $1" >&2; + fi + fi +} + +{ test "$1" = "clean" } && { + notice "Cleaning up all tuntaposx build" + rm -rf tuntaposx + act "Done." + return 0 +} + +build_tuntap() { + test -d tuntaposx || git clone $REPO + notice "Cloning tuntaposx sources" + cd tuntaposx/tuntap + notice "Building tuntaposx" + make + mkdir -p ../../dist/tun.kext + cp -r tun.kext/* ../../dist/tun.kext + mkdir -p ../../dist/tuntaposx/StartupItems + cp -r startup_item/tun ../../dist/tuntaposx/StartupItems + cd ../.. +} + +act "Building tuntap" +build_tuntap diff --git a/pkg/osx/install/ProcessNetworkChanges.plist.template b/pkg/osx/install/ProcessNetworkChanges.plist.template index faea8dee..eaf54fcf 100644 --- a/pkg/osx/install/ProcessNetworkChanges.plist.template +++ b/pkg/osx/install/ProcessNetworkChanges.plist.template @@ -3,7 +3,7 @@ <plist version="1.0"> <dict> <key>Label</key> - <string>net.tunnelblick.openvpn.process-network-changes</string> + <string>se.leap.openvpn.process-network-changes</string> <key>ProgramArguments</key> <array> <string>${DIR}/process-network-changes</string> diff --git a/pkg/osx/install/client.down.sh b/pkg/osx/install/client.down.sh index 47f00ed7..52ba4de6 100755 --- a/pkg/osx/install/client.down.sh +++ b/pkg/osx/install/client.down.sh @@ -2,7 +2,8 @@ # Note: must be bash; uses bash-specific tricks # # ****************************************************************************************************************** -# This Tunnelblick script does everything! It handles TUN and TAP interfaces, +# Based on the Tunnelblick script that just "does everything!" +# It handles TUN and TAP interfaces, # pushed configurations and DHCP leases. :) # # This is the "Down" version of the script, executed after the connection is @@ -11,6 +12,7 @@ # Created by: Nick Williams (using original code and parts of old Tblk scripts) # # ****************************************************************************************************************** +# TODO: review and adapt version 3 of the clientX.down.sh trap "" TSTP trap "" HUP @@ -22,34 +24,34 @@ readonly LOG_MESSAGE_COMMAND=$(basename "${0}") # Quick check - is the configuration there? if ! scutil -w State:/Network/OpenVPN &>/dev/null -t 1 ; then # Configuration isn't there, so we forget it - echo "$(date '+%a %b %e %T %Y') *Tunnelblick $LOG_MESSAGE_COMMAND: WARNING: No existing OpenVPN DNS configuration found; not tearing down anything; exiting." + echo "$(date '+%a %b %e %T %Y') *LEAPClient $LOG_MESSAGE_COMMAND: WARNING: No existing OpenVPN DNS configuration found; not tearing down anything; exiting." exit 0 fi -# NOTE: This script does not use any arguments passed to it by OpenVPN, so it doesn't shift Tunnelblick options out of the argument list +# NOTE: This script does not use any arguments passed to it by OpenVPN, so it doesn't shift LEAPClient options out of the argument list # Get info saved by the up script -TUNNELBLICK_CONFIG="$(/usr/sbin/scutil <<-EOF +LEAPCLIENT_CONFIG="$(/usr/sbin/scutil <<-EOF open show State:/Network/OpenVPN quit EOF)" -ARG_MONITOR_NETWORK_CONFIGURATION="$(echo "${TUNNELBLICK_CONFIG}" | grep -i '^[[:space:]]*MonitorNetwork :' | sed -e 's/^.*: //g')" -LEASEWATCHER_PLIST_PATH="$(echo "${TUNNELBLICK_CONFIG}" | grep -i '^[[:space:]]*LeaseWatcherPlistPath :' | sed -e 's/^.*: //g')" -PSID="$(echo "${TUNNELBLICK_CONFIG}" | grep -i '^[[:space:]]*Service :' | sed -e 's/^.*: //g')" -SCRIPT_LOG_FILE="$(echo "${TUNNELBLICK_CONFIG}" | grep -i '^[[:space:]]*ScriptLogFile :' | sed -e 's/^.*: //g')" -# Don't need: ARG_RESTORE_ON_DNS_RESET="$(echo "${TUNNELBLICK_CONFIG}" | grep -i '^[[:space:]]*RestoreOnDNSReset :' | sed -e 's/^.*: //g')" -# Don't need: ARG_RESTORE_ON_WINS_RESET="$(echo "${TUNNELBLICK_CONFIG}" | grep -i '^[[:space:]]*RestoreOnWINSReset :' | sed -e 's/^.*: //g')" -# Don't need: PROCESS="$(echo "${TUNNELBLICK_CONFIG}" | grep -i '^[[:space:]]*PID :' | sed -e 's/^.*: //g')" -# Don't need: ARG_IGNORE_OPTION_FLAGS="$(echo "${TUNNELBLICK_CONFIG}" | grep -i '^[[:space:]]*IgnoreOptionFlags :' | sed -e 's/^.*: //g')" -ARG_TAP="$(echo "${TUNNELBLICK_CONFIG}" | grep -i '^[[:space:]]*IsTapInterface :' | sed -e 's/^.*: //g')" -bRouteGatewayIsDhcp="$(echo "${TUNNELBLICK_CONFIG}" | grep -i '^[[:space:]]*RouteGatewayIsDhcp :' | sed -e 's/^.*: //g')" +ARG_MONITOR_NETWORK_CONFIGURATION="$(echo "${LEAPCLIENT_CONFIG}" | grep -i '^[[:space:]]*MonitorNetwork :' | sed -e 's/^.*: //g')" +LEASEWATCHER_PLIST_PATH="$(echo "${LEAPCLIENT_CONFIG}" | grep -i '^[[:space:]]*LeaseWatcherPlistPath :' | sed -e 's/^.*: //g')" +PSID="$(echo "${LEAPCLIENT_CONFIG}" | grep -i '^[[:space:]]*Service :' | sed -e 's/^.*: //g')" +SCRIPT_LOG_FILE="$(echo "${LEAPCLIENT_CONFIG}" | grep -i '^[[:space:]]*ScriptLogFile :' | sed -e 's/^.*: //g')" +# Don't need: ARG_RESTORE_ON_DNS_RESET="$(echo "${LEAPCLIENT_CONFIG}" | grep -i '^[[:space:]]*RestoreOnDNSReset :' | sed -e 's/^.*: //g')" +# Don't need: ARG_RESTORE_ON_WINS_RESET="$(echo "${LEAPCLIENT_CONFIG}" | grep -i '^[[:space:]]*RestoreOnWINSReset :' | sed -e 's/^.*: //g')" +# Don't need: PROCESS="$(echo "${LEAPCLIENT_CONFIG}" | grep -i '^[[:space:]]*PID :' | sed -e 's/^.*: //g')" +# Don't need: ARG_IGNORE_OPTION_FLAGS="$(echo "${LEAPCLIENT_CONFIG}" | grep -i '^[[:space:]]*IgnoreOptionFlags :' | sed -e 's/^.*: //g')" +ARG_TAP="$(echo "${LEAPCLIENT_CONFIG}" | grep -i '^[[:space:]]*IsTapInterface :' | sed -e 's/^.*: //g')" +bRouteGatewayIsDhcp="$(echo "${LEAPCLIENT_CONFIG}" | grep -i '^[[:space:]]*RouteGatewayIsDhcp :' | sed -e 's/^.*: //g')" # @param String message - The message to log logMessage() { - echo "$(date '+%a %b %e %T %Y') *Tunnelblick $LOG_MESSAGE_COMMAND: "${@} >> "${SCRIPT_LOG_FILE}" + echo "$(date '+%a %b %e %T %Y') *LEAP CLient $LOG_MESSAGE_COMMAND: "${@} >> "${SCRIPT_LOG_FILE}" } trim() @@ -97,7 +99,7 @@ WINS_OLD="$(/usr/sbin/scutil <<-EOF quit EOF)" TB_NO_SUCH_KEY="<dictionary> { - TunnelblickNoSuchKey : true + LEAPClientNoSuchKey : true }" if [ "${DNS_OLD}" = "${TB_NO_SUCH_KEY}" ] ; then diff --git a/pkg/osx/install/client.up.sh b/pkg/osx/install/client.up.sh index fc7e341a..be9814c2 100755 --- a/pkg/osx/install/client.up.sh +++ b/pkg/osx/install/client.up.sh @@ -2,7 +2,8 @@ # Note: must be bash; uses bash-specific tricks # # ****************************************************************************************************************** -# This Tunnelblick script does everything! It handles TUN and TAP interfaces, +# Taken from the Tunnelblick script that "just does everything!" +# It handles TUN and TAP interfaces, # pushed configurations, DHCP with DNS and WINS, and renewed DHCP leases. :) # # This is the "Up" version of the script, executed after the interface is @@ -11,6 +12,7 @@ # Created by: Nick Williams (using original code and parts of old Tblk scripts) # # ****************************************************************************************************************** +# TODO: review and adapt revision 3 of the clientX-up.sh instead trap "" TSTP trap "" HUP @@ -19,7 +21,7 @@ export PATH="/bin:/sbin:/usr/sbin:/usr/bin" # Process optional arguments (if any) for the script # Each one begins with a "-" -# They come from Tunnelblick, and come first, before the OpenVPN arguments +# They come from the leap-client invocation, and come first, before the OpenVPN arguments # So we set ARG_ script variables to their values and shift them out of the argument list # When we're done, only the OpenVPN arguments remain for the rest of the script to use ARG_MONITOR_NETWORK_CONFIGURATION="false" @@ -63,24 +65,25 @@ readonly ARG_MONITOR_NETWORK_CONFIGURATION ARG_RESTORE_ON_DNS_RESET ARG_RESTORE_ # then convert to regular config /Users/Jonathan/Library/Application Support/Tunnelblick/Configurations/Folder/Subfolder/config.ovpn # to get the script log path # Note: "/Users/..." works even if the home directory has a different path; it is used in the name of the log file, and is not used as a path to get to anything. -readonly TBALTPREFIX="/Library/Application Support/Tunnelblick/Users/" +readonly TBALTPREFIX="/Library/Application Support/LEAP Client/Users/" readonly TBALTPREFIXLEN="${#TBALTPREFIX}" readonly TBCONFIGSTART="${config:0:$TBALTPREFIXLEN}" if [ "$TBCONFIGSTART" = "$TBALTPREFIX" ] ; then readonly TBBASE="${config:$TBALTPREFIXLEN}" readonly TBSUFFIX="${TBBASE#*/}" readonly TBUSERNAME="${TBBASE%%/*}" - readonly TBCONFIG="/Users/$TBUSERNAME/Library/Application Support/Tunnelblick/Configurations/$TBSUFFIX" + readonly TBCONFIG="/Users/$TBUSERNAME/Library/Application Support/LEAP Client/Configurations/$TBSUFFIX" else readonly TBCONFIG="${config}" fi readonly CONFIG_PATH_DASHES_SLASHES="$(echo "${TBCONFIG}" | sed -e 's/-/--/g' | sed -e 's/\//-S/g')" -readonly SCRIPT_LOG_FILE="/Library/Application Support/Tunnelblick/Logs/${CONFIG_PATH_DASHES_SLASHES}.script.log" +# XXX PUT LOGS SOMEWHERE BETTER +readonly SCRIPT_LOG_FILE="/Users/$LEAPUSER/.config/leap/logs/${CONFIG_PATH_DASHES_SLASHES}.script.log" readonly TB_RESOURCE_PATH=$(dirname "${0}") -LEASEWATCHER_PLIST_PATH="/Library/Application Support/Tunnelblick/LeaseWatch.plist" +LEASEWATCHER_PLIST_PATH="/Users/$LEAPUSER/.config/leap/logs/LeaseWatch.plist" readonly OSVER="$(sw_vers | grep 'ProductVersion:' | grep -o '10\.[0-9]*')" @@ -92,7 +95,7 @@ bRouteGatewayIsDhcp="false" readonly LOG_MESSAGE_COMMAND=$(basename "${0}") logMessage() { - echo "$(date '+%a %b %e %T %Y') *Tunnelblick $LOG_MESSAGE_COMMAND: "${@} >> "${SCRIPT_LOG_FILE}" + echo "$(date '+%a %b %e %T %Y') *LEAP Client $LOG_MESSAGE_COMMAND: "${@} >> "${SCRIPT_LOG_FILE}" } # @param String string - Content to trim @@ -270,7 +273,7 @@ EOF )" fi # Now, do the aggregation - # Save the openvpn process ID and the Network Primary Service ID, leasewather.plist path, logfile path, and optional arguments from Tunnelblick, + # Save the openvpn process ID and the Network Primary Service ID, leasewather.plist path, logfile path, and optional arguments from LEAP Client, # then save old and new DNS and WINS settings # PPID is a bash-script variable that contains the process ID of the parent of the process running the script (i.e., OpenVPN's process ID) # config is an environmental variable set to the configuration path by OpenVPN prior to running this up script @@ -290,7 +293,7 @@ EOF )" CORRECT_OLD_WINS_KEY="State:" fi - # If we are not expecting any WINS value, add <TunnelblickNoSuchKey : true> to the expected WINS setup + # If we are not expecting any WINS value, add <LEAPClientNoSuchKey : true> to the expected WINS setup NO_NOSUCH_KEY_WINS="#" if [ "${NO_NB}" = "#" -a "${AGG_WINS}" = "#" -a "${NO_WG}" = "#" ] ; then NO_NOSUCH_KEY_WINS="" @@ -315,14 +318,14 @@ EOF )" set State:/Network/OpenVPN # First, back up the device's current DNS and WINS configurations - # Indicate 'no such key' by a dictionary with a single entry: "TunnelblickNoSuchKey : true" + # Indicate 'no such key' by a dictionary with a single entry: "LEAPClientNoSuchKey : true" d.init - d.add TunnelblickNoSuchKey true + d.add LEAPClientNoSuchKey true get ${CORRECT_OLD_DNS_KEY}/Network/Service/${PSID}/DNS set State:/Network/OpenVPN/OldDNS d.init - d.add TunnelblickNoSuchKey true + d.add LEAPClientNoSuchKey true get ${CORRECT_OLD_WINS_KEY}/Network/Service/${PSID}/SMB set State:/Network/OpenVPN/OldSMB @@ -353,7 +356,7 @@ EOF )" ${NO_NB}d.add NetBIOSName ${STATIC_NETBIOSNAME} ${AGG_WINS}d.add WINSAddresses * ${ALL_WINS_SERVERS} ${NO_WG}d.add Workgroup ${STATIC_WORKGROUP} - ${NO_NOSUCH_KEY_WINS}d.add TunnelblickNoSuchKey true + ${NO_NOSUCH_KEY_WINS}d.add LEAPClientNoSuchKey true set State:/Network/OpenVPN/SMB # We are done diff --git a/pkg/osx/install/install-leapc.sh b/pkg/osx/install/install-leapc.sh index 2ecfc08e..ec3c2834 100755 --- a/pkg/osx/install/install-leapc.sh +++ b/pkg/osx/install/install-leapc.sh @@ -1,17 +1,42 @@ -#!/bin/sh -echo "Installing LEAP Client in /Applications" -cp -r "LEAP Client.app" "/Applications" +#!/bin/bash -echo "Copying openvpn binary" +# LEAP CLient Installer Script. +# +# Copyright (C) 2013 LEAP Encryption Access Project +# +# This file is part of LEAP Client, as +# available from http://leap.se/. This file is free software; +# you can redistribute it and/or modify it under the terms of the GNU +# General Public License (GPL) as published by the Free Software +# Foundation, in version 2 as it comes in the "COPYING" file of the +# LEAP Client distribution. LEAP Client is distributed in the +# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. +# + +set -e + +destlibs=/opt/local/lib +leapdir=/Applications/LEAP\ Client.app +leaplibs=${leapdir}/Contents/MacOS +tunstartup=/Library/StartupItems/tun/tun + +echo "Installing LEAP Client in /Applications..." +cp -r "LEAP Client.app" /Applications + +echo "Copying openvpn binary..." cp -r openvpn.leap /usr/bin -echo "Installing tun/tap drivers" +echo "Installing tun/tap drivers..." +test -f $tunstartup && $tunstartup stop + +test -d /Library/Extensions || mkdir -p /Library/Extensions +test -d /Library/StartupItems || mkdir -p /Library/StartupItems + cp -r Extensions/* /Library/Extensions cp -r StartupItems/* /Library/StartupItems -echo "Loading tun/tap kernel extension" -/Library/StartupItems/tun/tun start +echo "Loading tun/tap kernel extension..." -echo "Installation Finished!" +$tunstartup start -ln -s /Applications/LEAP\ Client.app/ /Volumes/LEAP\ Client\ installer/ +echo "Installation Finished!" diff --git a/pkg/osx/install/tun.kext/Info.plist b/pkg/osx/install/tun.kext/Info.plist new file mode 100644 index 00000000..fb69ba85 --- /dev/null +++ b/pkg/osx/install/tun.kext/Info.plist @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>tun</string> + <key>CFBundleIdentifier</key> + <string>leap.tun</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>tun</string> + <key>CFBundlePackageType</key> + <string>KEXT</string> + <key>CFBundleShortVersionString</key> + <string>20120120</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1.0</string> + <key>OSBundleLibraries</key> + <dict> + <key>com.apple.kpi.mach</key> + <string>8.0</string> + <key>com.apple.kpi.bsd</key> + <string>8.0</string> + <key>com.apple.kpi.libkern</key> + <string>8.0</string> + <key>com.apple.kpi.unsupported</key> + <string>8.0</string> + </dict> +</dict> +</plist> + diff --git a/pkg/osx/leap-client.spec b/pkg/osx/leap-client.spec index 75bf991b..91aa20d6 100644 --- a/pkg/osx/leap-client.spec +++ b/pkg/osx/leap-client.spec @@ -2,8 +2,8 @@ a = Analysis(['../../src/leap/app.py'], pathex=[ '../../src/leap', - '/Users/kaliy/leap/leap-client-testbuild/src/leap-client/pkg/osx'], - hiddenimports=['atexit'], + '/Users/kaliy/leap/leap_client/src/leap-client/pkg/osx'], + hiddenimports=['atexit', 'leap.common'], hookspath=None) pyz = PYZ(a.pure) exe = EXE(pyz, @@ -18,7 +18,7 @@ coll = COLLECT(exe, a.binaries + # this will easitly break if we setup the venv # somewhere else. FIXME - [('cacert.pem', '../../../../lib/python2.6/site-packages/requests/cacert.pem', 'DATA'), + [('cacert.pem', '/Users/kaliy/.Virtualenvs/leap-client/lib/python2.6/site-packages/requests-1.1.0-py2.6.egg/requests/cacert.pem', 'DATA'), ], a.zipfiles, a.datas, diff --git a/pkg/osx/tuntaposx b/pkg/osx/tuntaposx new file mode 160000 +Subproject 4e07e2e96b092fb3bb9bbf53ae97c0a53f8aed9 diff --git a/pkg/postmkvenv.sh b/pkg/postmkvenv.sh index 593b11da..2f0cba45 100755 --- a/pkg/postmkvenv.sh +++ b/pkg/postmkvenv.sh @@ -9,14 +9,14 @@ # use import PyQt4; PyQt4.__path__ instead platform='unknown' -unamestr=`uname` +unamestr=$(uname) if [[ "$unamestr" == 'Linux' ]]; then platform='linux' elif [[ "$unamestr" == 'Darwin' ]]; then platform='darwin' fi -LIBS=( PyQt4 sip.so ) +LIBS=( PySide ) PYTHON_VERSION=python$(python -c "import sys; print (str(sys.version_info[0])+'.'+str(sys.version_info[1]))") VAR=( $(which -a $PYTHON_VERSION) ) @@ -34,5 +34,7 @@ fi for LIB in ${LIBS[@]} do - ln -s $LIB_SYSTEM_PATH/$LIB $LIB_VIRTUALENV_PATH/$LIB + if [[ ! -e $LIB_VIRTUALENV_PATH/$LIB ]]; then + ln -s $LIB_SYSTEM_PATH/$LIB $LIB_VIRTUALENV_PATH/$LIB + fi done diff --git a/pkg/requirements-dev.pip b/pkg/requirements-dev.pip new file mode 100644 index 00000000..71ffdc37 --- /dev/null +++ b/pkg/requirements-dev.pip @@ -0,0 +1,17 @@ +# --------------------------- +# -- external requirements -- +# -- during development -- +# --------------------------- +# +# For temporary work, you can point this to your developer repo. +# consolidated changes will be pushed to pypi and then added +# to the main requirements.pip +# +# NOTE: you have to run pip install -r pkg/requirements.pip for pip +# to install it. (do it after python setup.py develop and it +# will only install this) + +sphinx + +-e git+git://github.com/leapcode/leap_pycommon.git@develop#egg=leap.common +-e git+git://github.com/leapcode/soledad.git@develop#egg=leap.soledad diff --git a/pkg/requirements-testing.pip b/pkg/requirements-testing.pip new file mode 100644 index 00000000..2df5fe56 --- /dev/null +++ b/pkg/requirements-testing.pip @@ -0,0 +1,18 @@ +nose +nose-exclude +nose-progressive + + +unittest2 # TODO we should include this dep only for python2.6 +coverage +pep8>=1.1 +tox + +#sphinx>=1.1.2 + +# double reqs +# (the client already includes, which gives some errors) +# ----------- +# mock # re-add XXX +#twisted +#zope.interface diff --git a/pkg/requirements.pip b/pkg/requirements.pip index 839722de..1b72ed6a 100644 --- a/pkg/requirements.pip +++ b/pkg/requirements.pip @@ -1,17 +1,27 @@ # in order of addition to the project. -# do not change the ordering. +# try not to change the ordering. +# +# PySide -- It's a requirement indeed, but +# it gives troubles when operating inside virtualenvs. +# Use LEAP_VENV_SKIP_PYSIDE to avoid installing it! -argparse # only for python 2.6 -requests<1.0.0 -psutil -netifaces -pyopenssl -jsonschema #>0.7 +argparse +requests srp>=1.0.2 -pycrypto +pyopenssl keyring python-dateutil -sh -pyxdg +psutil +ipaddr +twisted +qt4reactor +python-gnupg + +leap.common>=0.2.5 +leap.soledad>=0.1.0 + +# Remove this when nickserver is online +mock -pygeoip # optional +# Remove this when u1db fixes its dependency on oauth +oauth diff --git a/pkg/scripts/leap_client_bootstrap.sh b/pkg/scripts/leap_client_bootstrap.sh index 6c302d3f..dcde64f9 100644 --- a/pkg/scripts/leap_client_bootstrap.sh +++ b/pkg/scripts/leap_client_bootstrap.sh @@ -38,7 +38,7 @@ pip install -e 'git://leap.se/leap_client@develop#egg=leap-client' cd leap-client-testbuild -# symlink the pyqt libraries to the system libs +# symlink the pyside libraries to the system libs ./src/leap-client/pkg/postmkvenv.sh echo "${cc_green}leap-client installed! =)" diff --git a/pkg/test-requirements.pip b/pkg/test-requirements.pip deleted file mode 100644 index a7349bfc..00000000 --- a/pkg/test-requirements.pip +++ /dev/null @@ -1,8 +0,0 @@ -unittest2 # TODO we should include this dep only for python2.6 -coverage -mock -nose -pep8==1.1 -sphinx>=1.1.2 -nose-exclude -tox diff --git a/pkg/utils.py b/pkg/utils.py index 52680ae5..deace14b 100644 --- a/pkg/utils.py +++ b/pkg/utils.py @@ -1,13 +1,37 @@ +# -*- coding: utf-8 -*- +# utils.py +# Copyright (C) 2013 LEAP +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + """ -utils to help in the setup process +Utils to help in the setup process """ + import os import re import sys -# gets reqs from the first matching file def get_reqs_from_files(reqfiles): + """ + Returns the contents of the top requirement file listed as a + string list with the lines + + @param reqfiles: requirement files to parse + @type reqfiles: list of str + """ for reqfile in reqfiles: if os.path.isfile(reqfile): return open(reqfile, 'r').read().split('\n') @@ -16,12 +40,26 @@ def get_reqs_from_files(reqfiles): def parse_requirements(reqfiles=['requirements.txt', 'requirements.pip', 'pkg/requirements.pip']): + """ + Parses the requirement files provided. + + Checks the value of LEAP_VENV_SKIP_PYSIDE to see if it should + return PySide as a dep or not. Don't set, or set to 0 if you want + to install it through pip. + + @param reqfiles: requirement files to parse + @type reqfiles: list of str + """ + requirements = [] + skip_pyside = os.getenv("LEAP_VENV_SKIP_PYSIDE", "0") != "0" for line in get_reqs_from_files(reqfiles): # -e git://foo.bar/baz/master#egg=foobar if re.match(r'\s*-e\s+', line): - requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', - line)) + pass + # do not try to do anything with externals on vcs + #requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', + #line)) # http://foo.bar/baz/foobar/zipball/master#egg=foobar elif re.match(r'\s*https?:', line): requirements.append(re.sub(r'\s*https?:.*#egg=(.*)$', r'\1', @@ -34,9 +72,13 @@ def parse_requirements(reqfiles=['requirements.txt', # adding it to the requirements list screws distro installs elif line == 'argparse' and sys.version_info >= (2, 7): pass + elif line == 'PySide' and skip_pyside: + pass + # do not include comments + elif line.lstrip().startswith('#'): + pass else: if line != '': requirements.append(line) - #print 'REQUIREMENTS', requirements return requirements diff --git a/pkg/windows/openvpn_manifest b/pkg/windows/openvpn_manifest new file mode 100644 index 00000000..7c6a542a --- /dev/null +++ b/pkg/windows/openvpn_manifest @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <assemblyIdentity version="1.0.0.0" name="openvpn_leap" /> + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> + <security> + <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> + <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> + </requestedPrivileges> + <applicationRequestMinimum> + <defaultAssemblyRequest permissionSetReference="Custom" /> + <PermissionSet class="System.Security.PermissionSet" version="1" ID="Custom" SameSite="site" /> + </applicationRequestMinimum> + </security> + </trustInfo> + <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> + <application> + </application> + </compatibility> +</asmv1:assembly>
\ No newline at end of file |