summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.coveragerc23
-rw-r--r--.gitattributes1
-rw-r--r--.gitignore11
-rw-r--r--.tx/config10
-rw-r--r--MANIFEST.in5
-rw-r--r--Makefile35
-rw-r--r--NEWS.rst14
-rw-r--r--data/TODO1
-rw-r--r--data/images/leapfrog.jpgbin0 -> 1767 bytes
-rw-r--r--debian/README.source9
-rw-r--r--debian/changelog19
-rw-r--r--debian/clean1
-rw-r--r--debian/compat1
-rw-r--r--debian/control52
-rw-r--r--debian/copyright17
-rw-r--r--debian/docs3
-rw-r--r--debian/leap-client.install3
-rw-r--r--debian/leap-client.xpm281
-rw-r--r--debian/manpages1
-rw-r--r--debian/menu7
-rwxr-xr-xdebian/rules60
-rw-r--r--debian/source/format1
-rw-r--r--debian/source/include-binaries1
-rw-r--r--ez_setup.py284
-rw-r--r--openvpn/README6
-rw-r--r--openvpn/Sources4
-rwxr-xr-xopenvpn/build.zsh191
-rw-r--r--pkg/requirements.pip2
-rwxr-xr-xrun_tests.sh23
-rw-r--r--setup.cfg3
-rwxr-xr-xsetup.py2
-rw-r--r--setup/install_venv.py242
-rw-r--r--setup/linux/leap.desktop13
-rw-r--r--setup/linux/polkit/net.openvpn.gui.leap.policy23
-rw-r--r--setup/requirements.pip1
-rwxr-xr-xsetup/scripts/leap6
-rw-r--r--setup/test-requires5
-rwxr-xr-xsetup/tools/with_venv.sh4
-rw-r--r--tests/test_qt_environment.py6
-rw-r--r--tox.ini12
40 files changed, 1073 insertions, 310 deletions
diff --git a/.coveragerc b/.coveragerc
deleted file mode 100644
index bcf38d0f..00000000
--- a/.coveragerc
+++ /dev/null
@@ -1,23 +0,0 @@
-# .coveragerc to control coverage.py
-[run]
-branch = True
-
-[report]
-# Regexes for lines to exclude from consideration
-exclude_lines =
- # Have to re-enable the standard pragma
- pragma: no cover
-
- # Don't complain about missing debug-only code:
- def __repr__
- if self\.debug
-
- # Don't complain if tests don't hit defensive assertion code:
- raise AssertionError
- raise NotImplementedError
-
- # Don't complain if non-runnable code isn't run:
- if 0:
- if __name__ == .__main__.:
-
-ignore_errors = True
diff --git a/.gitattributes b/.gitattributes
index eb8672e0..36222847 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -16,4 +16,3 @@ man/ export-ignore
share/ export-ignore
src/leap.egg-info/ export-ignore
src/leap_client.egg-info export-ignore
-src/leap/_version.py export-subst
diff --git a/.gitignore b/.gitignore
index a9b7c1c8..26838e5c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,7 @@
*.swp
*.swo
*.pyc
-*.log
.*
-!.coveragerc
-!.tx
bin/
build/
core
@@ -15,13 +12,7 @@ docs/covhtml
include/
lib/
local/
+man/
share/
src/leap.egg-info/
src/leap_client.egg-info
-src/leap/_branding.py
-src/leap/certs/*.pem
-src/*.egg-info
-pkg/osx/dist
-pkg/osx/build
-MANIFEST
-_trial_temp*
diff --git a/.tx/config b/.tx/config
deleted file mode 100644
index db998b21..00000000
--- a/.tx/config
+++ /dev/null
@@ -1,10 +0,0 @@
-[main]
-host = https://www.transifex.com
-
-[leap-client.leap-client]
-
-file_filter = data/translations/<lang>.ts
-source_file = data/ts/en_US.ts
-source_lang = en
-type = QT
-#minimum_perc = 90 # minimum percentage completed before pulling
diff --git a/MANIFEST.in b/MANIFEST.in
index d7a5201e..3ce64e45 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,4 +1,3 @@
-include pkg/*
-include pkg/branding/*
+# ??? not needed from win
+include setup/linux/polkit/*
include docs/*
-include versioneer.py
diff --git a/Makefile b/Makefile
index 8d63232f..fc4a172a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,37 +1,26 @@
-SHELL := /bin/zsh
# ################################
# Makefile for compiling resources
# files.
# TODO move to setup scripts
# and implement it in python
# http://die-offenbachs.homelinux.org:48888/hg/eric5/file/5072605ad4dd/compileUiFiles.py
-###### EDIT ######################
-
+###### EDIT ######################
#Directory with ui and resource files
RESOURCE_DIR = data/resources
#Directory for compiled resources
COMPILED_DIR = src/leap/gui
-
-#Directory for (finished) translations
-TRANSLAT_DIR = data/translations
-
-#Project file, used for translations
-PROJFILE = data/leap_client.pro
#UI files to compile
# UI_FILES = foo.ui
UI_FILES =
#Qt resource files to compile
#images.qrc
-RESOURCES = mainwindow.qrc locale.qrc
+RESOURCES = mainwindow.qrc
#pyuic4 and pyrcc4 binaries
PYUIC = pyuic4
PYRCC = pyrcc4
-PYLUP = pylupdate4
-LRELE = lrelease
-
#################################
# DO NOT EDIT FOLLOWING
@@ -48,10 +37,6 @@ all : resources ui
resources : $(COMPILED_RESOURCES)
ui : $(COMPILED_UI)
-
-translations:
- $(PYLUP) $(PROJFILE)
- $(LRELE) $(TRANSLAT_DIR)/*.ts
$(COMPILED_DIR)/ui_%.py : $(RESOURCE_DIR)/%.ui
$(PYUIC) $< -o $@
@@ -59,11 +44,27 @@ $(COMPILED_DIR)/ui_%.py : $(RESOURCE_DIR)/%.ui
$(COMPILED_DIR)/%_rc.py : $(RESOURCE_DIR)/%.qrc
$(PYRCC) $< -o $@
+deb:
+ #XXX finish this!
+ #should tag upstream/VERSION in upstream branch...
+ #@git tag -a upstream/$(DEBVER) -m "..."
+ @git-buildpackage --git-ignore-new --git-builder="debuild -us -uc -i'.*|bin|share|lib|local|include|\.git'" --git-upstream-branch=upstream --git-upstream-tree=branch --git-debian-branch=debian
+
manpages:
rst2man docs/man/leap-client.1.rst docs/man/leap-client.1
apidocs:
@sphinx-apidoc -o docs/api src/leap
+cleandebinstall:
+ rm debian/files
+ rm debian/leap-client.debhelper.log
+ rm debian/leap-client.postinst.debhelper
+ rm debian/leap-client.postrm.debhelper
+ rm debian/leap-client.prerm.debhelper
+ rm debian/leap-client.substvars
+ rm -rf debian/leap-client/
+
+
clean :
$(RM) $(COMPILED_UI) $(COMPILED_RESOURCES) $(COMPILED_UI:.py=.pyc) $(COMPILED_RESOURCES:.py=.pyc)
diff --git a/NEWS.rst b/NEWS.rst
index 45f1012f..7ff703eb 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -1,12 +1,12 @@
==================================
-User-facing changes in Leap Client
+User-facing changes in LEAP Client
==================================
-Release 0.2.0 (2013-1-XX)
+Release 0.2.0 (2013-2-23)
--------------------------
This release is a functionally working version in Debian Wheezy and Ubuntu 12.04.
-It is able to connect to a preconfigured leap provider and autoconfigures a EIP connection.
+It is able to connect to a preconfigured LEAP provider and autoconfigures a EIP connection.
Python Support
''''''''''''''
@@ -28,16 +28,15 @@ See the ``README.rst`` for a step-to-step install guide.
The following libraries are needed:
- PyQt4
-- libgnutls
+- OpenSSL
- openvpn
for building the package dependencies, you will need also:
- python-setuptools
- python-dev
-- libgnutls-dev
-Leap-Client depends on the following python packages:
+leap-client depends on the following python packages:
- pyopenssl
- requests
@@ -48,9 +47,6 @@ Leap-Client depends on the following python packages:
- pycrypto
- keyring
-We are freezing the python-gnutls library dependency for this release due to a bug in ubuntu, see:
-https://bugs.launchpad.net/ubuntu/+source/python-gnutls/+bug/1027129
-
Configuration files
'''''''''''''''''''
diff --git a/data/TODO b/data/TODO
new file mode 100644
index 00000000..580227ac
--- /dev/null
+++ b/data/TODO
@@ -0,0 +1 @@
+icons file and stuff should be moved here at some point!
diff --git a/data/images/leapfrog.jpg b/data/images/leapfrog.jpg
new file mode 100644
index 00000000..a1ddf4bb
--- /dev/null
+++ b/data/images/leapfrog.jpg
Binary files differ
diff --git a/debian/README.source b/debian/README.source
new file mode 100644
index 00000000..da12f753
--- /dev/null
+++ b/debian/README.source
@@ -0,0 +1,9 @@
+leap-client for Debian
+-----------------------------
+
+<this file describes information about the source package, see Debian policy
+manual section 4.14. You WILL either need to modify or delete this file>
+
+
+
+
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 00000000..4dc42d92
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,19 @@
+leap-client (0.2.0~rc+874bbf7local) unstable; urgency=low
+ [ Kali ]
+ * add python-jsonschema dependency >= 0.8
+ * generate manpage from .rst file
+ * fixes to sphinxdoc install
+ * merged release/v0.2.0 branch
+ * updated dependency list
+
+ [ Micah Anderson ]
+ * updated build-dependencies to have necessary packages to pass tests
+ * removed unused comments from control file
+ * move build-depends to source package section of control file
+ * switch source/format to 3.0 (native)
+ * fix build-dependency on python-mock
+
+ [ Kali ]
+ * Initial release (Closes: #XXX)
+
+ -- Ben Carrillo <ben@futeisha.org> Fri, 01 Feb 2013 02:40:00 -0900
diff --git a/debian/clean b/debian/clean
new file mode 100644
index 00000000..322f3a67
--- /dev/null
+++ b/debian/clean
@@ -0,0 +1 @@
+docs/man/leap-client.1
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 00000000..45a4fb75
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+8
diff --git a/debian/control b/debian/control
new file mode 100644
index 00000000..bbb57bea
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,52 @@
+Source: leap-client
+Section: misc
+Priority: extra
+Maintainer: Ben Carrillo <ben@futeisha.org>
+Standards-Version: 3.9.4
+Homepage: http://leap.se
+#Vcs-Git: git://git.debian.org/python-applications-team/leap-client.git
+#Vcs-Browser: http://git.debian.org/?p=python-applications-team/leap-client.git;a=summary
+Build-Depends: debhelper (>= 8.0.0), python-support, python (>=2.6), python-setuptools,
+ python-qt4, pep8,
+ python-sphinx (>= 1.0.7+dfsg), docutils-common, python-nose, python-mock,
+ python-requests (<= 0.15), python-srp, python-crypto, python-keyring, python-xdg,
+ python-jsonschema (>= 0.7.0), python-psutil, python-openssl, python-sh,
+ python-dateutil, python-argparse, python-netifaces,
+ xvfb, xauth
+X-Python-Version: >= 2.6
+
+Package: leap-client
+Architecture: all
+Depends: ${misc:Depends}, ${python:Depends},
+ python-qt4,
+ python-openssl,
+ python-crypto,
+ python-keyring,
+ python-srp,
+ python-dateutil,
+ python-argparse,
+ python-psutil,
+ python-netifaces,
+ python-requests (>= 0.10),
+ python-requests (<= 0.15),
+ python-xdg,
+ python-jsonschema (>= 0.7.0),
+ python-sh,
+ python-setuptools,
+ python-nose,
+ python-mock,
+ pep8,
+ openvpn,
+ policykit-1-gnome
+Suggests: resolvconf
+Conflicts: autoresolv
+Enhances: openvpn
+Description: Provides the desktop client for the LEAP Encryption Access Project Platform.
+ LEAP (LEAP Encryption Access Project) develops
+ a plan to secure everyday communication, breaking down
+ into discrete services.
+ .
+ The client for the current phase gives support to the EIP Service.
+ EIP (the Encrypted Internet Proxy) provides circumvention, location
+ anonymization, and traffic encryption in a hassle-free,
+ automatically self-configuring fashion, and has an enhanced level of security.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 00000000..fff117e1
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,17 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: leap-client
+Upstream-Contact: info@leap.se
+Source: <http://github.com/leapcode/leap_client/>
+
+Files: *
+Copyright: 2012,2013 The LEAP Encryption Access Project
+License: GPL-3+
+ This package is released under the GNU GPL, version 3 or a later revision.
+ For further details see the COPYING file.
+ .
+ On Debian systems, the full text of the GNU General Public
+ License version 3 can be found in the file
+ `/usr/share/common-licenses/GPL-3'.
+
+# REVIEW-ME This needs a licensecheck -r run !!! -- kali
+# Do we need to add the GPL OpenSSL exception??
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 00000000..fc8df7fd
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1,3 @@
+# XXX fix path...
+#NEWS.rst
+#README.rst
diff --git a/debian/leap-client.install b/debian/leap-client.install
new file mode 100644
index 00000000..2a470423
--- /dev/null
+++ b/debian/leap-client.install
@@ -0,0 +1,3 @@
+pkg/linux/polkit/net.openvpn.gui.leap.policy usr/share/polkit-1/actions/
+pkg/linux/resolv-update etc/leap/
+debian/leap-client.xpm usr/share/pixmaps
diff --git a/debian/leap-client.xpm b/debian/leap-client.xpm
new file mode 100644
index 00000000..4aca802e
--- /dev/null
+++ b/debian/leap-client.xpm
@@ -0,0 +1,281 @@
+/* XPM */
+static char * leap_client_xpm[] = {
+"32 26 252 2",
+" c None",
+". c #370F14",
+"+ c #942F2F",
+"@ c #E1415B",
+"# c #C616A8",
+"$ c #540A45",
+"% c #DC831E",
+"& c #FF4E54",
+"* c #FF554B",
+"= c #EB1BC5",
+"- c #F81ECD",
+"; c #30082A",
+"> c #202E3A",
+", c #C19C00",
+"' c #F5961F",
+") c #FF5051",
+"! c #F02AA7",
+"~ c #EB1DC2",
+"{ c #646BC6",
+"] c #3A1445",
+"^ c #2D7CE5",
+"/ c #458AD0",
+"( c #002745",
+"_ c #2C9BCB",
+": c #03353B",
+"< c #B28F00",
+"[ c #EEC100",
+"} c #F69122",
+"| c #F6348B",
+"1 c #B051D4",
+"2 c #207AFF",
+"3 c #5A1B1E",
+"4 c #9D436B",
+"5 c #7E68AC",
+"6 c #3F3161",
+"7 c #03111D",
+"8 c #3589F9",
+"9 c #88D6E2",
+"0 c #6CD6CF",
+"a c #10D363",
+"b c #0F960F",
+"c c #1C5810",
+"d c #426C38",
+"e c #747295",
+"f c #888572",
+"g c #F1C100",
+"h c #EFC500",
+"i c #F18943",
+"j c #1977CB",
+"k c #2F1613",
+"l c #A76A00",
+"m c #FFB400",
+"n c #C84D06",
+"o c #3A4051",
+"p c #384200",
+"q c #AEE200",
+"r c #CCFF00",
+"s c #BEEB16",
+"t c #3081A5",
+"u c #0F5EAB",
+"v c #427898",
+"w c #FFFF1C",
+"x c #B6E300",
+"y c #5C6D5D",
+"z c #B71C00",
+"A c #B53C00",
+"B c #812D00",
+"C c #000306",
+"D c #829F43",
+"E c #337FBD",
+"F c #0094CD",
+"G c #0048BA",
+"H c #0137C8",
+"I c #718270",
+"J c #461087",
+"K c #3E0634",
+"L c #050100",
+"M c #59B3CB",
+"N c #2F9CC7",
+"O c #2670B4",
+"P c #512180",
+"Q c #592078",
+"R c #582379",
+"S c #2A0453",
+"T c #000000",
+"U c #3EBFD6",
+"V c #0083AA",
+"W c #334E95",
+"X c #62317C",
+"Y c #572E80",
+"Z c #171EA2",
+"` c #000007",
+" . c #003017",
+".. c #004792",
+"+. c #0078AA",
+"@. c #0030A6",
+"#. c #0013A3",
+"$. c #0014A3",
+"%. c #00149C",
+"&. c #006117",
+"*. c #00576C",
+"=. c #002987",
+"-. c #250F6E",
+";. c #25087D",
+">. c #0214A0",
+",. c #000C61",
+"'. c #008700",
+"). c #189E0D",
+"!. c #5B6857",
+"~. c #012780",
+"{. c #0C207B",
+"]. c #400066",
+"^. c #10001B",
+"/. c #0B2105",
+"(. c #9EBF2C",
+"_. c #B3CB34",
+":. c #EBE20D",
+"<. c #FEEA00",
+"[. c #FDD702",
+"}. c #CBA614",
+"|. c #68BA5F",
+"1. c #67B359",
+"2. c #65AF56",
+"3. c #4E9D6B",
+"4. c #33B9BF",
+"5. c #9ECBFF",
+"6. c #4A93D2",
+"7. c #0E420C",
+"8. c #7CC41F",
+"9. c #E2A40E",
+"0. c #FE9B09",
+"a. c #FF9907",
+"b. c #D9B026",
+"c. c #9BC54F",
+"d. c #75CC66",
+"e. c #76CC65",
+"f. c #4EBEA7",
+"g. c #27C5C3",
+"h. c #2ECDE3",
+"i. c #62C9F1",
+"j. c #A3D575",
+"k. c #011328",
+"l. c #EFD300",
+"m. c #BA7303",
+"n. c #FF9A08",
+"o. c #C6BA34",
+"p. c #BEC03B",
+"q. c #83C95D",
+"r. c #66C77F",
+"s. c #48BDB2",
+"t. c #2CB190",
+"u. c #00C6C2",
+"v. c #34CEE4",
+"w. c #00C3BE",
+"x. c #AF5505",
+"y. c #FAB123",
+"z. c #8A6515",
+"A. c #0E2125",
+"B. c #303626",
+"C. c #FACD0A",
+"D. c #D2A100",
+"E. c #976500",
+"F. c #A1780C",
+"G. c #B8BE3C",
+"H. c #4DC3A7",
+"I. c #47B5AD",
+"J. c #30A88B",
+"K. c #009C48",
+"L. c #12732D",
+"M. c #245221",
+"N. c #1D8E92",
+"O. c #66632D",
+"P. c #A2451B",
+"Q. c #E87F0E",
+"R. c #B98043",
+"S. c #000008",
+"T. c #269FB6",
+"U. c #012025",
+"V. c #2D3121",
+"W. c #8C9B68",
+"X. c #C9B32C",
+"Y. c #A58300",
+"Z. c #2F6601",
+"`. c #0C4603",
+" + c #1E313B",
+".+ c #0E161A",
+"++ c #011B0F",
+"@+ c #011509",
+"#+ c #3D1D0F",
+"$+ c #893B18",
+"%+ c #D85A00",
+"&+ c #C2764E",
+"*+ c #5C3098",
+"=+ c #1359D5",
+"-+ c #4A7490",
+";+ c #191831",
+">+ c #393B7A",
+",+ c #A2BA71",
+"'+ c #AEE983",
+")+ c #286106",
+"!+ c #335200",
+"~+ c #121A00",
+"{+ c #1A0B04",
+"]+ c #5F2B60",
+"^+ c #3F469C",
+"/+ c #0070CE",
+"(+ c #0765A6",
+"_+ c #3FB2FF",
+":+ c #3C97F4",
+"<+ c #BB696F",
+"[+ c #683623",
+"}+ c #338500",
+"|+ c #36C10F",
+"1+ c #009A24",
+"2+ c #265D07",
+"3+ c #1E3000",
+"4+ c #3A1F42",
+"5+ c #003060",
+"6+ c #292742",
+"7+ c #665472",
+"8+ c #9A1B00",
+"9+ c #D32E09",
+"0+ c #8A290F",
+"a+ c #00370F",
+"b+ c #0FA11F",
+"c+ c #00C736",
+"d+ c #00B51C",
+"e+ c #2A5900",
+"f+ c #401700",
+"g+ c #811900",
+"h+ c #BC0D00",
+"i+ c #C0520C",
+"j+ c #00E43E",
+"k+ c #00DB3D",
+"l+ c #00B015",
+"m+ c #009E00",
+"n+ c #142600",
+"o+ c #220C00",
+"p+ c #782000",
+"q+ c #A60600",
+"r+ c #4E9928",
+"s+ c #00A50D",
+"t+ c #008200",
+"u+ c #005A00",
+"v+ c #521800",
+"w+ c #EA1D00",
+"x+ c #016200",
+"y+ c #006200",
+"z+ c #812200",
+"A+ c #AA2700",
+"B+ c #002200",
+"C+ c #170000",
+" ",
+" . + @ # $ ",
+" % & * = - ; > ",
+" , ' ) ! ~ { ] ^ / ",
+" ( _ : < [ } | 1 2 3 4 5 6 ",
+" 7 8 9 0 a b c d e f g h i j k l m n o ",
+" p q r s t u v w x y z A B C ",
+" D E F G H I J K L ",
+" M N O P Q R S ",
+" T U V W X Y Z ` ",
+" ...+.@.#.$.%. ",
+" &.*.=.-.;.>.,. ",
+" '.).!.~.{.].^. ",
+" /.(._.:.<.[.}.|.1.2.3.4.5.6. ",
+" 7.8.9.0.a.b.c.d.e.f.g.h.i.j.k. ",
+" l.m.n.o.p.q.r.s.t.u.v.w.x.y.z. A. ",
+" B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S. T.U.",
+" V.W.X.Y.Z.`. +.+++@+ #+$+%+&+*+=+-+ ",
+" ;+>+ ,+'+)+!+~+ {+]+^+/+ ",
+" (+_+:+<+[+ }+|+1+2+3+ 4+5+ ",
+" 6+7+8+9+0+ a+b+c+d+e+ ",
+" f+g+h+i+j+k+l+m+n+ ",
+" o+p+q+r+s+t+u+ ",
+" v+w+x+y+ ",
+" z+A+B+ ",
+" C+ "};
diff --git a/debian/manpages b/debian/manpages
new file mode 100644
index 00000000..322f3a67
--- /dev/null
+++ b/debian/manpages
@@ -0,0 +1 @@
+docs/man/leap-client.1
diff --git a/debian/menu b/debian/menu
new file mode 100644
index 00000000..1ea0047a
--- /dev/null
+++ b/debian/menu
@@ -0,0 +1,7 @@
+?package(leap-client):needs="X11"\
+ hints="LEAP,Routing,Network Routing,Anonymous,openvpn"\
+ section="Applications/System/Security"\
+ title="LEAP-Client Internet Encryption Toolkit"\
+ command="/usr/bin/leap-client"\
+ icon="/usr/share/pixmaps/leap-client.xpm"
+
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 00000000..91890e36
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,60 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+#
+# Uncomment this to turn on verbose mode.
+#DH_VERBOSE=1
+
+PYTHON2=$(shell pyversions -vr)
+
+%:
+ dh $@ --with python2,sphinxdoc --buildsystem=python_distutils
+
+override_dh_prep:
+ rst2man docs/man/leap-client.1.rst docs/man/leap-client.1
+ dh_prep
+
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+
+# run tests!
+#
+
+test-python%:
+ xvfb-run ./run_tests.sh -x -N
+
+override_dh_auto_test: $(PYTHON2:%=test-python%) $(PYTHON3:%=test-python%)
+endif
+
+#dh_auto_build should be enough to build the python2 version
+
+build-python%:
+ python$* setup.py build
+
+#override_dh_auto_build: $(PYTHON3:%=build-python%)
+# dh_auto_build
+
+install-python%:
+ python$* setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb
+
+#override_dh_auto_install: $(PYTHON3:%=install-python%)
+# dh_auto_install
+
+override_dh_installchangelogs:
+ dh_installchangelogs -k NEWS.rst
+
+# build and install sphinx docs
+#
+override_dh_installdocs:
+ python setup.py build_sphinx
+ dh_installdocs build/sphinx/html
+
+override_dh_auto_clean:
+ dh_auto_clean
+ rm -rf build
+ rm -rf docs/_build
+ rm -rf *.egg-info
+ rm docs/man/leap-client.1
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 00000000..89ae9db8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/debian/source/include-binaries b/debian/source/include-binaries
new file mode 100644
index 00000000..9868b8e2
--- /dev/null
+++ b/debian/source/include-binaries
@@ -0,0 +1 @@
+dist/leap_client-0.1dev-py2.7.egg
diff --git a/ez_setup.py b/ez_setup.py
new file mode 100644
index 00000000..b74adc06
--- /dev/null
+++ b/ez_setup.py
@@ -0,0 +1,284 @@
+#!python
+"""Bootstrap setuptools 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 ez_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 sys
+DEFAULT_VERSION = "0.6c11"
+DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3]
+
+md5_data = {
+ 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca',
+ 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
+ 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b',
+ 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a',
+ 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618',
+ 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac',
+ 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5',
+ 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
+ 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
+ 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
+ 'setuptools-0.6c10-py2.3.egg': 'ce1e2ab5d3a0256456d9fc13800a7090',
+ 'setuptools-0.6c10-py2.4.egg': '57d6d9d6e9b80772c59a53a8433a5dd4',
+ 'setuptools-0.6c10-py2.5.egg': 'de46ac8b1c97c895572e5e8596aeb8c7',
+ 'setuptools-0.6c10-py2.6.egg': '58ea40aef06da02ce641495523a0b7f5',
+ 'setuptools-0.6c11-py2.3.egg': '2baeac6e13d414a9d28e7ba5b5a596de',
+ 'setuptools-0.6c11-py2.4.egg': 'bd639f9b0eac4c42497034dec2ec0c2b',
+ 'setuptools-0.6c11-py2.5.egg': '64c94f3bf7a72a13ec83e0b24f2749b2',
+ 'setuptools-0.6c11-py2.6.egg': 'bfa92100bd772d5a213eedd356d64086',
+ 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
+ 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
+ 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
+ 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e',
+ 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e',
+ 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f',
+ 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2',
+ 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc',
+ 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167',
+ 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64',
+ 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d',
+ 'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20',
+ 'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab',
+ 'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53',
+ 'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2',
+ 'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e',
+ 'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372',
+ 'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902',
+ 'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de',
+ 'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b',
+ 'setuptools-0.6c9-py2.3.egg': 'a83c4020414807b496e4cfbe08507c03',
+ 'setuptools-0.6c9-py2.4.egg': '260a2be2e5388d66bdaee06abec6342a',
+ 'setuptools-0.6c9-py2.5.egg': 'fe67c3e5a17b12c0e7c541b7ea43a8e6',
+ 'setuptools-0.6c9-py2.6.egg': 'ca37b1ff16fa2ede6e19383e7b59245a',
+}
+
+import sys, os
+try: from hashlib import md5
+except ImportError: from md5 import md5
+
+def _validate_md5(egg_name, data):
+ if egg_name in md5_data:
+ digest = md5(data).hexdigest()
+ if digest != md5_data[egg_name]:
+ print >>sys.stderr, (
+ "md5 validation of %s failed! (Possible download problem?)"
+ % egg_name
+ )
+ sys.exit(2)
+ return data
+
+def use_setuptools(
+ version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
+ download_delay=15
+):
+ """Automatically find/download setuptools and make it available on sys.path
+
+ `version` should be a valid setuptools 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 setuptools will be downloaded, if
+ it is not already available. If `download_delay` is specified, it should
+ be the number of seconds that will be paused before initiating a download,
+ should one be required. If an older version of setuptools is installed,
+ this routine will print a message to ``sys.stderr`` and raise SystemExit in
+ an attempt to abort the calling script.
+ """
+ was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules
+ def do_download():
+ egg = download_setuptools(version, download_base, to_dir, download_delay)
+ sys.path.insert(0, egg)
+ import setuptools; setuptools.bootstrap_install_from = egg
+ try:
+ import pkg_resources
+ except ImportError:
+ return do_download()
+ try:
+ pkg_resources.require("setuptools>="+version); return
+ except pkg_resources.VersionConflict, e:
+ if was_imported:
+ print >>sys.stderr, (
+ "The required version of setuptools (>=%s) is not available, and\n"
+ "can't be installed while this script is running. Please install\n"
+ " a more recent version first, using 'easy_install -U setuptools'."
+ "\n\n(Currently using %r)"
+ ) % (version, e.args[0])
+ sys.exit(2)
+ except pkg_resources.DistributionNotFound:
+ pass
+
+ del pkg_resources, sys.modules['pkg_resources'] # reload ok
+ return do_download()
+
+def download_setuptools(
+ version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
+ delay = 15
+):
+ """Download setuptools from a specified location and return its filename
+
+ `version` should be a valid setuptools 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.
+ """
+ import urllib2, shutil
+ egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
+ url = download_base + egg_name
+ saveto = os.path.join(to_dir, egg_name)
+ src = dst = None
+ if not os.path.exists(saveto): # Avoid repeated downloads
+ try:
+ from distutils import log
+ if delay:
+ log.warn("""
+---------------------------------------------------------------------------
+This script requires setuptools version %s to run (even to display
+help). I will attempt to download it for you (from
+%s), but
+you may need to enable firewall access for this script first.
+I will start the download in %d seconds.
+
+(Note: if this machine does not have network access, please obtain the file
+
+ %s
+
+and place it in this directory before rerunning this script.)
+---------------------------------------------------------------------------""",
+ version, download_base, delay, url
+ ); from time import sleep; sleep(delay)
+ log.warn("Downloading %s", url)
+ src = urllib2.urlopen(url)
+ # Read/write all in one block, so we don't create a corrupt file
+ # if the download is interrupted.
+ data = _validate_md5(egg_name, src.read())
+ dst = open(saveto,"wb"); dst.write(data)
+ finally:
+ if src: src.close()
+ if dst: dst.close()
+ return os.path.realpath(saveto)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+def main(argv, version=DEFAULT_VERSION):
+ """Install or upgrade setuptools and EasyInstall"""
+ try:
+ import setuptools
+ except ImportError:
+ egg = None
+ try:
+ egg = download_setuptools(version, delay=0)
+ sys.path.insert(0,egg)
+ from setuptools.command.easy_install import main
+ return main(list(argv)+[egg]) # we're done here
+ finally:
+ if egg and os.path.exists(egg):
+ os.unlink(egg)
+ else:
+ if setuptools.__version__ == '0.0.1':
+ print >>sys.stderr, (
+ "You have an obsolete version of setuptools installed. Please\n"
+ "remove it from your system entirely before rerunning this script."
+ )
+ sys.exit(2)
+
+ req = "setuptools>="+version
+ import pkg_resources
+ try:
+ pkg_resources.require(req)
+ except pkg_resources.VersionConflict:
+ try:
+ from setuptools.command.easy_install import main
+ except ImportError:
+ from easy_install import main
+ main(list(argv)+[download_setuptools(delay=0)])
+ sys.exit(0) # try to force an exit
+ else:
+ if argv:
+ from setuptools.command.easy_install import main
+ main(argv)
+ else:
+ print "Setuptools version",version,"or greater has been installed."
+ print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
+
+def update_md5(filenames):
+ """Update our built-in md5 registry"""
+
+ import re
+
+ for name in filenames:
+ base = os.path.basename(name)
+ f = open(name,'rb')
+ md5_data[base] = md5(f.read()).hexdigest()
+ f.close()
+
+ data = [" %r: %r,\n" % it for it in md5_data.items()]
+ data.sort()
+ repl = "".join(data)
+
+ import inspect
+ srcfile = inspect.getsourcefile(sys.modules[__name__])
+ f = open(srcfile, 'rb'); src = f.read(); f.close()
+
+ match = re.search("\nmd5_data = {\n([^}]+)}", src)
+ if not match:
+ print >>sys.stderr, "Internal error!"
+ sys.exit(2)
+
+ src = src[:match.start(1)] + repl + src[match.end(1):]
+ f = open(srcfile,'w')
+ f.write(src)
+ f.close()
+
+
+if __name__=='__main__':
+ if len(sys.argv)>2 and sys.argv[1]=='--md5update':
+ update_md5(sys.argv[2:])
+ else:
+ main(sys.argv[1:])
+
+
+
+
+
+
diff --git a/openvpn/README b/openvpn/README
deleted file mode 100644
index bf2205c2..00000000
--- a/openvpn/README
+++ /dev/null
@@ -1,6 +0,0 @@
-OpenVPN binary, build scripts
-Works using a GCC minGW32 cross-compiler on Debian/Ubuntu
-Produces a working MS Windows executable
-openvpn.exe: PE32 executable (DLL) (console) Intel 80386, for MS Windows
-goes smooth for the 99%, might still need some slapping the flags around now and then
- -jrml
diff --git a/openvpn/Sources b/openvpn/Sources
deleted file mode 100644
index e2fe7bb3..00000000
--- a/openvpn/Sources
+++ /dev/null
@@ -1,4 +0,0 @@
-lzo -2.06 .tar.gz
-opensc -0.12.2 .tar.gz
-openssl -1.0.1c .tar.gz
-polarssl -1.1.4 .tgz
diff --git a/openvpn/build.zsh b/openvpn/build.zsh
deleted file mode 100755
index b36717c1..00000000
--- a/openvpn/build.zsh
+++ /dev/null
@@ -1,191 +0,0 @@
-#!/bin/zsh
-#
-# Copyright (C) 2012 Denis Roio <jaromil@dyne.org>
-#
-# This source code is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This source code 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.
-# Please refer to the GNU Public License for more details.
-#
-# You should have received a copy of the GNU Public License along with
-# this source code; if not, write to:
-# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-
-REPO="http://files.dyne.org/leap/openvpn/sources"
-TOPSRC=`pwd`
-QUIET=0
-DEBUG=0
-
-
-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 build in ${TOPSRC}"
- for src in `cat Sources | awk '
-/^#/ {next}
-/^./ { print $1 }'`; do
- { test "$src" != "" } && { rm -rf "${src}" }
- done
- act "Done."
- return 0
-}
-
-os="`uname -s`"
-target="$1"
-notice "OpenVPN build on $os for $target in ${TOPSRC}"
-
-prepare_sources() {
- notice "Preparing sources"
- # look for a file names "Sources", download and decompress entries
- # format of file: name version compression (complete filename when merged)
- { test -r Sources } || {
- error "Sources not found, nothing to build here"
- return 1
- }
- for src in `cat Sources | awk '
-/^#/ {next}
-/^./ { print $1 ";" $2 ";" $3 }'`; do
- name="${src[(ws:;:)1]}"
- ver="${src[(ws:;:)2]}"
- arch="${src[(ws:;:)3]}"
- file="${name}${ver}${arch}"
- func "preparing source for ${name}${ver}"
-
- { test "$1" != "" } && {
- test "$1" != "$name" } && {
- continue }
-
- # download the file
- { test -r ${file} } || {
- act "downloading ${file}"
- curl ${REPO}/${file} -o ${file}
- }
- # decompress the file
- { test -r ${name} } || {
- act "decompressing ${name}"
- case $arch in
- ## BARE SOURCE
- .tar.gz) tar xfz ${file}; mv ${name}${ver} ${name} ;;
- .tar.bz2) tar xfj ${file}; mv ${name}${ver} ${name} ;;
- .tgz) tar xfz ${file}; mv ${name}${ver} ${name} ;;
- *) error "compression not supported: $arch"
- esac
- }
- act "${name} source ready"
- done
-}
-
-act "Downloading sources"
-
-# git clone latest openvpn
-{ test -r openvpn } || { git clone https://github.com/OpenVPN/openvpn.git }
-
-case "$os" in
- Darwin)
- prepare_sources lzo
- prepare_sources polarssl
- ;;
- Linux) # Cross-compile for Win32
- prepare_sources lzo
- prepare_sources opensc
- prepare_sources openssl
- # tap windows
- { test -r tap-windows } || { git clone https://github.com/OpenVPN/tap-windows.git }
- ;;
-esac
-
-notice "Sources ready, now compiling..."
-LOG="`pwd`/build.log"; touch ${LOG}
-act "logs saved in build.log"
-
-case "$target" in
- osx)
- { test -r polarssl/library/libpolarssl.a } || {
- act "building PolarSSL..."
- pushd polarssl
- CC=clang cmake . >> ${LOG}
- make -C library clean
- cat CMakeCache.txt | awk '
-/^CMAKE_C_COMPILER/ { print "CMAKE_C_COMPILER:FILEPATH=/usr/bin/clang"; next }
-/^CMAKE_BUILD_TYPE/ { print $1 "Release"; next }
-/^CMAKE_C_FLAGS:STRING/ { print "CMAKE_C_FLAGS:STRING=-arch x86_64 -arch i386"; next }
-{ print $0 }
-' > CMakeCache.leap
- cp CMakeCache.leap CMakeCache.txt
- make -C library >> ${LOG}
- popd
- act "done."
- }
-
- act "building OpenVPN"
- pushd openvpn
- CC=clang CFLAGS="-arch x86_64 -arch i386" \
- LZO_LIBS="/opt/local/lib/liblzo2.a" LZO_CFLAGS="-I/opt/local/include" \
- POLARSSL_CFLAGS="-I${TOPSRC}/polarssl/include" \
- POLARSSL_LIBS="${TOPSRC}/polarssl/library/libpolarssl.a" \
- ./configure --with-crypto-library=polarssl >> ${LOG}
- make src/openvpn/openvpn
- popd
- act "done."
- ;;
-
- win32)
- { test -r lzo/src/liblzo2.la } || { pushd lzo
- act "building LZO lib"
- ./configure --host=i586-mingw32msvc >> ${LOG}
- make >> ${LOG}; popd }
- # openssl
- { test -r openssl/libssl.a } || {
- act "building OpenSSL lib"
- pushd openssl
- ./Configure --cross-compile-prefix=i586-mingw32msvc- mingw >> ${LOG}
- make ${LOG}; popd }
-
- pushd openvpn
- act "building latest OpenVPN"
- { test -r configure } || {
- sed -i -e 's/-municode//' src/openvpn/Makefile.am
- autoreconf -i >> ${LOG}
- }
- CFLAGS="-I/usr/i586-mingw32msvc/include/ddk -D_WIN32_WINNT=0x0501" \
- LZO_LIBS="${TOPSRC}/lzo/src/liblzo2.la" \
- LZO_CFLAGS="-I${TOPSRC}/lzo/include" \
- TAP_CFLAGS="-I${TOPSRC}/tap-windows/src" \
- OPENSSL_SSL_CFLAGS="-I${TOPSRC}/openssl/include" \
- OPENSSL_CRYPTO_CFLAGS="-I${TOPSRC}/openssl/crypto" \
- OPENSSL_SSL_LIBS="${TOPSRC}/openssl/libssl.a" \
- OPENSSL_CRYPTO_LIBS="${TOPSRC}/openssl/libcrypto.a" \
- ./configure --host=i586-mingw32msvc >> ${LOG}
- make >> ${LOG}
- popd
-
- act "If OpenVPN build reports a final error on linkage, it might be due to a libtool bug"
- act "(something like undefined reference to _WinMain@16)"
- act "You need to go inside openvpn/src/openvpn and issue the last compile line manually"
- act "adding an flat '-shared' at the end of it, then do 'cp .libs/openvpn.exe .'"
- act "Happy hacking."
- ;;
- *)
- error "Unknown target: $target"
- ;;
-esac
diff --git a/pkg/requirements.pip b/pkg/requirements.pip
index 839722de..01d4289f 100644
--- a/pkg/requirements.pip
+++ b/pkg/requirements.pip
@@ -14,4 +14,4 @@ python-dateutil
sh
pyxdg
-pygeoip # optional
+#pygeoip # optional
diff --git a/run_tests.sh b/run_tests.sh
index 7cbed018..ebea30b2 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -15,7 +15,6 @@ function usage {
echo " -P, --no-pep8 Don't run pep8"
echo " -c, --coverage Generate coverage report"
echo " -h, --help Print this usage message"
- echo " -A, --all Run all tests, without excluding any"
echo " --hide-elapsed Don't print the elapsed time for each test along with slow test list"
echo ""
echo "Note: with no options specified, the script will try to run the tests in a virtual environment,"
@@ -34,14 +33,13 @@ function process_option {
-p|--pep8) just_pep8=1;;
-P|--no-pep8) no_pep8=1;;
-c|--coverage) coverage=1;;
- -A|--all) alltests=1;;
-*) noseopts="$noseopts $1";;
*) noseargs="$noseargs $1"
esac
}
venv=.venv
-with_venv=pkg/tools/with_venv.sh
+with_venv=setup/tools/with_venv.sh
always_venv=0
never_venv=0
force=0
@@ -53,7 +51,6 @@ wrapper=""
just_pep8=0
no_pep8=0
coverage=0
-alltests=0
for arg in "$@"; do
process_option $arg
@@ -68,11 +65,6 @@ if [ $no_site_packages -eq 1 ]; then
installvenvopts="--no-site-packages"
fi
-# If alltests flag is not set, let's exclude some dirs that are troublesome.
-if [ $alltests -eq 0 ]; then
- noseopts="$noseopts --exclude-dir=src/leap/soledad"
-fi
-
function run_tests {
# Just run the test suites in current environment
${wrapper} $NOSETESTS
@@ -85,7 +77,7 @@ function run_pep8 {
echo "Running pep8 ..."
srcfiles="src/leap tests"
# Just run PEP8 in current environment
- pep8_opts="--ignore=E202,W602 --exclude=*_rc.py,_version.py --repeat"
+ pep8_opts="--ignore=E202,W602 --exclude=*_rc.py --repeat"
${wrapper} pep8 ${pep8_opts} ${srcfiles}
}
@@ -107,14 +99,14 @@ then
else
if [ $always_venv -eq 1 ]; then
# Automatically install the virtualenv
- python pkg/install_venv.py $installvenvopts
+ python setup/install_venv.py $installvenvopts
wrapper="${with_venv}"
else
echo -e "No virtual environment found...create one? (Y/n) \c"
read use_ve
if [ "x$use_ve" = "xY" -o "x$use_ve" = "x" -o "x$use_ve" = "xy" ]; then
# Install the virtualenv and run the test suite in it
- python pkg/install_venv.py $installvenvopts
+ python setup/install_venv.py $installvenvopts
wrapper=${with_venv}
fi
fi
@@ -140,10 +132,9 @@ if [ -z "$noseargs" ]; then
fi
function run_coverage {
- cov_opts="--omit=`pwd`/src/leap/base/tests/*,`pwd`/src/leap/eip/tests/*,`pwd`/src/leap/gui/tests/*"
- cov_opts="$cov_opts,`pwd`/src/leap/util/tests/* "
- cov_opts="$cov_opts --include=`pwd`/src/leap/*" #,`pwd`/src/leap/eip/*"
- ${wrapper} coverage html -d docs/covhtml -i $cov_opts
+ # XXX not working? getting 3rd party modules
+ coverage_opts="--include `pwd`/src/leap/*,`pwd`/src/leap/eip/*"
+ ${wrapper} coverage html -d docs/covhtml -i $coverage_opts
echo "now point your browser at docs/covhtml/index.html"
}
diff --git a/setup.cfg b/setup.cfg
index 4b049f97..01bb9544 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,2 +1,3 @@
[egg_info]
-#tag_build = dev
+tag_build = dev
+tag_svn_revision = true
diff --git a/setup.py b/setup.py
index a7016b94..ae7b2757 100755
--- a/setup.py
+++ b/setup.py
@@ -208,7 +208,7 @@ setup(
zip_safe=False,
# not being used since setuptools does not like it.
- # looks like debhelper is honoring it...
+ # but looks that debhelper honors it...
data_files=[
# ("share/man/man1",
# ["docs/man/leap-client.1"]),
diff --git a/setup/install_venv.py b/setup/install_venv.py
new file mode 100644
index 00000000..3f3f0575
--- /dev/null
+++ b/setup/install_venv.py
@@ -0,0 +1,242 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2010 United States Government as represented by the
+# Administrator of the National Aeronautics and Space Administration.
+# All Rights Reserved.
+#
+# Copyright 2010 OpenStack, LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+"""
+Installation script for Nova's development virtualenv
+"""
+
+import optparse
+import os
+import subprocess
+import sys
+import platform
+
+
+ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
+VENV = os.path.join(ROOT, '.venv')
+PIP_REQUIRES = os.path.join(ROOT, 'tools', 'pip-requires')
+TEST_REQUIRES = os.path.join(ROOT, 'tools', 'test-requires')
+PY_VERSION = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
+
+
+def die(message, *args):
+ print >> sys.stderr, message % args
+ sys.exit(1)
+
+
+def check_python_version():
+ if sys.version_info < (2, 6):
+ die("Need Python Version >= 2.6")
+
+
+def run_command_with_code(cmd, redirect_output=True, check_exit_code=True):
+ """
+ Runs a command in an out-of-process shell, returning the
+ output of that command. Working directory is ROOT.
+ """
+ if redirect_output:
+ stdout = subprocess.PIPE
+ else:
+ stdout = None
+
+ print 'executing command: %s', cmd
+ proc = subprocess.Popen(cmd, cwd=ROOT, stdout=stdout)
+ output = proc.communicate()[0]
+ if check_exit_code and proc.returncode != 0:
+ die('Command "%s" failed.\n%s', ' '.join(cmd), output)
+ return (output, proc.returncode)
+
+
+def run_command(cmd, redirect_output=True, check_exit_code=True):
+ return run_command_with_code(cmd, redirect_output, check_exit_code)[0]
+
+
+class Distro(object):
+
+ def check_cmd(self, cmd):
+ return bool(run_command(['which', cmd], check_exit_code=False).strip())
+
+ def install_virtualenv(self):
+ if self.check_cmd('virtualenv'):
+ return
+
+ if self.check_cmd('easy_install'):
+ print 'Installing virtualenv via easy_install...',
+ if run_command(['easy_install', 'virtualenv']):
+ print 'Succeeded'
+ return
+ else:
+ print 'Failed'
+
+ die('ERROR: virtualenv not found.\n\nDevelopment'
+ ' requires virtualenv, please install it using your'
+ ' favorite package management tool')
+
+ def post_process(self):
+ """Any distribution-specific post-processing gets done here.
+
+ In particular, this is useful for applying patches to code inside
+ the venv."""
+ pass
+
+
+class Debian(Distro):
+ """This covers all Debian-based distributions."""
+
+ def check_pkg(self, pkg):
+ return run_command_with_code(['dpkg', '-l', pkg],
+ check_exit_code=False)[1] == 0
+
+ def apt_install(self, pkg, **kwargs):
+ run_command(['sudo', 'apt-get', 'install', '-y', pkg], **kwargs)
+
+ def apply_patch(self, originalfile, patchfile):
+ run_command(['patch', originalfile, patchfile])
+
+ def install_virtualenv(self):
+ if self.check_cmd('virtualenv'):
+ return
+
+ if not self.check_pkg('python-virtualenv'):
+ self.apt_install('python-virtualenv', check_exit_code=False)
+
+ super(Debian, self).install_virtualenv()
+
+
+class Fedora(Distro):
+ """This covers all Fedora-based distributions.
+
+ Includes: Fedora, RHEL, CentOS, Scientific Linux"""
+
+ def check_pkg(self, pkg):
+ return run_command_with_code(['rpm', '-q', pkg],
+ check_exit_code=False)[1] == 0
+
+ def yum_install(self, pkg, **kwargs):
+ run_command(['sudo', 'yum', 'install', '-y', pkg], **kwargs)
+
+ def apply_patch(self, originalfile, patchfile):
+ run_command(['patch', originalfile, patchfile])
+
+ def install_virtualenv(self):
+ if self.check_cmd('virtualenv'):
+ return
+
+ if not self.check_pkg('python-virtualenv'):
+ self.yum_install('python-virtualenv', check_exit_code=False)
+
+ super(Fedora, self).install_virtualenv()
+
+
+def get_distro():
+ if os.path.exists('/etc/fedora-release') or \
+ os.path.exists('/etc/redhat-release'):
+ return Fedora()
+ elif os.path.exists('/etc/debian_version'):
+ return Debian()
+ else:
+ return Distro()
+
+
+def check_dependencies():
+ get_distro().install_virtualenv()
+
+
+def create_virtualenv(venv=VENV, no_site_packages=True):
+ """Creates the virtual environment and installs PIP only into the
+ virtual environment
+ """
+ print 'Creating venv...',
+ if no_site_packages:
+ run_command(['virtualenv', '-q', '--no-site-packages', VENV])
+ else:
+ run_command(['virtualenv', '-q', VENV])
+ print 'done.'
+ print 'Installing pip in virtualenv...',
+ if not run_command(['setup/tools/with_venv.sh', 'easy_install',
+ 'pip>1.0']).strip():
+ die("Failed to install pip.")
+ print 'done.'
+
+
+def pip_install(*args):
+ run_command(['setup/tools/with_venv.sh',
+ 'pip', 'install', '--upgrade'] + list(args),
+ redirect_output=False)
+
+
+def install_dependencies(venv=VENV):
+ print 'Installing dependencies with pip (this can take a while)...'
+
+ # First things first, make sure our venv has the latest pip and distribute.
+ pip_install('pip')
+ pip_install('distribute')
+
+ pip_install('-r', PIP_REQUIRES)
+ pip_install('-r', TEST_REQUIRES)
+
+ # "
+ pthfile = os.path.join(venv, "lib", PY_VERSION, "site-packages",
+ "leap-client.pth")
+ f = open(pthfile, 'w')
+ f.write("%s\n" % ROOT)
+
+
+def post_process():
+ get_distro().post_process()
+
+
+def print_help():
+ help = """
+ To activate the leap virtualenv for the extent of your current
+ shell session you can run:
+
+ $ source .venv/bin/activate
+
+ Or, if you prefer, you can run commands in the virtualenv on a case by case
+ basis by running:
+
+ $ setup/tools/with_venv.sh <your command>
+
+ Also, make test will automatically use the virtualenv.
+ """
+ print help
+
+
+def parse_args():
+ """Parse command-line arguments"""
+ parser = optparse.OptionParser()
+ parser.add_option("-n", "--no-site-packages", dest="no_site_packages",
+ default=False, action="store_true",
+ help="Do not inherit packages from global Python install")
+ return parser.parse_args()
+
+
+def main(argv):
+ (options, args) = parse_args()
+ check_python_version()
+ check_dependencies()
+ create_virtualenv(no_site_packages=options.no_site_packages)
+ install_dependencies()
+ post_process()
+ print_help()
+
+if __name__ == '__main__':
+ main(sys.argv)
diff --git a/setup/linux/leap.desktop b/setup/linux/leap.desktop
new file mode 100644
index 00000000..7a6d39d9
--- /dev/null
+++ b/setup/linux/leap.desktop
@@ -0,0 +1,13 @@
+[Desktop Entry]
+Version=0.1.0
+Encoding=UTF-8
+Name=EIP
+Comment=Anonymity and privacy
+Comment[en]=Anonymity and privacy
+Comment[es]=Anonimato y privacidad
+Comment[sv]=Anonymitet och avlyssningsskydd
+Exec=leap
+Terminal=false
+Type=Application
+Icon=leap.png
+Categories=Network;
diff --git a/setup/linux/polkit/net.openvpn.gui.leap.policy b/setup/linux/polkit/net.openvpn.gui.leap.policy
new file mode 100644
index 00000000..70a22b65
--- /dev/null
+++ b/setup/linux/polkit/net.openvpn.gui.leap.policy
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE policyconfig PUBLIC
+ "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
+<policyconfig>
+
+ <vendor>LEAP Project</vendor>
+ <vendor_url>http://leap.se/</vendor_url>
+
+ <action id="net.openvpn,gui.leap.run-openvpn">
+ <description>Runs the openvpn binary</description>
+ <description xml:lang="es">Ejecuta el binario openvpn</description>
+ <message>OpenVPN needs that you authenticate to start</message>
+ <message xml:lang="es">OpenVPN necesita autorizacion para comenzar</message>
+ <icon_name>package-x-generic</icon_name>
+ <defaults>
+ <allow_any>auth_self_keep</allow_any>
+ <allow_inactive>auth_self_keep</allow_inactive>
+ <allow_active>auth_self_keep</allow_active>
+ </defaults>
+ <annotate key="org.freedesktop.policykit.exec.path">/usr/sbin/openvpn</annotate>
+ </action>
+</policyconfig>
diff --git a/setup/requirements.pip b/setup/requirements.pip
new file mode 100644
index 00000000..1352d5e6
--- /dev/null
+++ b/setup/requirements.pip
@@ -0,0 +1 @@
+argparse
diff --git a/setup/scripts/leap b/setup/scripts/leap
new file mode 100755
index 00000000..6e62b597
--- /dev/null
+++ b/setup/scripts/leap
@@ -0,0 +1,6 @@
+#!/usr/bin/env python
+
+from leap.app import main
+
+if __name__ == "__main__":
+ main()
diff --git a/setup/test-requires b/setup/test-requires
new file mode 100644
index 00000000..26db61c8
--- /dev/null
+++ b/setup/test-requires
@@ -0,0 +1,5 @@
+coverage
+mock
+nose
+pep8==1.1
+sphinx>=1.1.2
diff --git a/setup/tools/with_venv.sh b/setup/tools/with_venv.sh
new file mode 100755
index 00000000..0e58f1ab
--- /dev/null
+++ b/setup/tools/with_venv.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+TOOLS=`dirname $0`
+VENV=$TOOLS/../../.venv
+source $VENV/bin/activate && $@
diff --git a/tests/test_qt_environment.py b/tests/test_qt_environment.py
index e90d527f..08fccf4b 100644
--- a/tests/test_qt_environment.py
+++ b/tests/test_qt_environment.py
@@ -2,7 +2,7 @@ import sys
import unittest
import sip
-#sip.setapi('QVariant', 2)
+sip.setapi('QVariant', 2)
from PyQt4 import QtGui
@@ -37,7 +37,3 @@ class QtEnvironTest(unittest.TestCase):
self.assertEqual(
self.win.trayIcon.isSystemTrayAvailable(),
True)
-
-
-if __name__ == "__main__":
- unittest.main()
diff --git a/tox.ini b/tox.ini
deleted file mode 100644
index a9107c71..00000000
--- a/tox.ini
+++ /dev/null
@@ -1,12 +0,0 @@
-[tox]
-envlist = py26,py27
-
-[testenv]
-deps = -r{toxinidir}/pkg/requirements.pip
- -r{toxinidir}/pkg/test-requirements.pip
-sitepackages = True
-commands = xvfb-run nosetests leap --exclude-dir=src/leap/soledad
-
-[testenv:pep8]
-deps = pep8==1.1
-commands = pep8 --repeat --show-source src/leap setup.py --ignore=E202,W602 --exclude=*_rc.py --repeat