diff options
author | Yen Chi Hsuan | 2016-04-16 03:11:24 +0800 |
---|---|---|
committer | Yen Chi Hsuan | 2016-04-16 03:11:24 +0800 |
commit | 554fb78f2a5ba4c5802920bfe5dd802e351a14ec (patch) | |
tree | be2b282c6ddd148a7748e63107810cd97d56276e | |
download | aur-554fb78f2a5ba4c5802920bfe5dd802e351a14ec.tar.gz |
Build and install OK
-rw-r--r-- | .SRCINFO | 31 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | PKGBUILD | 59 | ||||
-rw-r--r-- | README.ArchLinux | 37 | ||||
-rw-r--r-- | issue2481.patch | 148 | ||||
-rw-r--r-- | jython.install | 20 | ||||
-rw-r--r-- | jython.sh | 1 |
7 files changed, 297 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..60b17bc71c1c --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,31 @@ +# Generated by mksrcinfo v8 +# Fri Apr 15 19:11:19 UTC 2016 +pkgbase = jython-hg + pkgdesc = An implementation of the Python language written in Java + pkgver = r7918+.87534ec6252a+ + pkgrel = 1 + url = http://www.jython.org/ + install = jython.install + arch = any + license = PSF + license = APACHE + license = custom + makedepends = apache-ant + depends = jdk7-openjdk + depends = bash + depends = python2 + provides = jython + conflicts = jython + options = !emptydirs + backup = opt/jython/registry + source = hg+https://hg.python.org/jython/ + source = README.ArchLinux + source = jython.sh + source = issue2481.patch + md5sums = SKIP + md5sums = 0a2e265af61c7d695e13b605dc180553 + md5sums = c08ade059dae86b015f39842ceb465cf + md5sums = a9f1dc09c8fdb2f1b3a0a2b9793a44df + +pkgname = jython-hg + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..626c2642f19d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/jython/ diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..2bfedf181b4b --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,59 @@ +# $Id: PKGBUILD 134107 2015-05-25 23:45:31Z dwallace $ +# Maintainer: Daniel Wallace <danielwallace at gtmanfred dot com> +# Contributor: Chris Brannon <cmbrannon79@gmail.com> +# Contributor: Geoffroy Carrier <geoffroy.carrier@aur.archlinux.org> +# Contributor: Richard Murri <admin@richardmurri.com> +_pkgname=jython +pkgname=$_pkgname-hg +pkgver=r7918+.87534ec6252a+ +pkgrel=1 +pkgdesc="An implementation of the Python language written in Java" +arch=('any') +url="http://www.jython.org/" +license=('PSF' 'APACHE' 'custom') +# Jython requires jdk7 for correct building +# TODO: Find a way to accept both jdk7 and jdk7-openjdk +depends=('jdk7-openjdk' 'bash' 'python2') +makedepends=('apache-ant') +backup=('opt/jython/registry') +options=('!emptydirs') +install='jython.install' +source=("hg+https://hg.python.org/jython/" + 'README.ArchLinux' + 'jython.sh' + 'issue2481.patch') +provides=('jython') +conflicts=('jython') + +md5sums=('SKIP' + '0a2e265af61c7d695e13b605dc180553' + 'c08ade059dae86b015f39842ceb465cf' + 'a9f1dc09c8fdb2f1b3a0a2b9793a44df') + +pkgver() { + cd "$srcdir/$_pkgname" + printf "r%s.%s" "$(hg identify -n)" "$(hg identify -i)" +} + +prepare() { + cd "$srcdir/$_pkgname" + patch -i ../issue2481.patch -Np1 +} + +build() { + cd "$srcdir/$_pkgname" + + JAVA_HOME="/usr/lib/jvm/java-7-openjdk" ant +} + +package() { + install -m755 -D -d "$pkgdir/opt/" + + cp -r "$srcdir/$_pkgname/dist" "$pkgdir/opt/$_pkgname" + rm "$pkgdir/opt/jython/bin/"{jython.exe,jython_regrtest.bat,python27.dll} + + install -m644 -D "$srcdir/jython.sh" "$pkgdir/etc/profile.d/jython.sh" + install -m644 -D "$srcdir/README.ArchLinux" "$pkgdir/usr/share/doc/$_pkgname/README.ArchLinux" + + install -m644 -D "$srcdir/$_pkgname/LICENSE.txt" "$pkgdir/usr/share/licenses/$_pkgname/LICENSE.txt" +} diff --git a/README.ArchLinux b/README.ArchLinux new file mode 100644 index 000000000000..4b6940848c71 --- /dev/null +++ b/README.ArchLinux @@ -0,0 +1,37 @@ +Important Notes +=============== +The user is strongly advised to create a file named +~/.jython, containing the following line: +python.cachedir=/home/USERNAME/.jythoncachedir +where USERNAME is your username. +Environment variable expansion and ~ expansion are not honored in this file, +so you cannot represent /home/USERNAME with ~/ or $HOME. + +Jython uses caching to improve performance. By default, it tries to +use a global directory as its cache. This fails, because the directory +is not writable by non-privileged users. + +Some GNU/Linux distributions solve this problem by setting python.cachedir +in the launcher script, when the JVM is invoked. +E.G., +java -Dpython.cachedir="${HOME}/.jythoncachedir" ... +That solution seems nice, because jython usually does the +right thing when invoked via the launcher script. +However, it has three limitations. + +1. If jython is not started via the launcher, it will not cache in +~/.jythoncachedir. It will try to cache in the aforementioned global +directory! +2. Specifying -Dpython.cachedir on the java command-line guarantees that +the setting will be ignored if it is found in ~/.jython. +Thus, the user cannot override the setting in his configuration file when +the launcher is used. +3. It enforces a distribution-specific policy. + +The best approach is simply to let the user specify +python.cachedir in ~/.jython. + +jythonc +======= +The jythonc tool is not included by upstream in the 2.5.x series of jython. +Thus, it is no longer available in this package. diff --git a/issue2481.patch b/issue2481.patch new file mode 100644 index 000000000000..5eff88db807e --- /dev/null +++ b/issue2481.patch @@ -0,0 +1,148 @@ +diff -r 87534ec6252a lib-python/2.7/urllib2.py +--- a/lib-python/2.7/urllib2.py Sat Mar 19 13:25:23 2016 +1100 ++++ b/lib-python/2.7/urllib2.py Sat Apr 16 02:59:36 2016 +0800 +@@ -109,6 +109,14 @@ + except ImportError: + from StringIO import StringIO + ++# check for SSL ++try: ++ import ssl ++except ImportError: ++ _have_ssl = False ++else: ++ _have_ssl = True ++ + from urllib import (unwrap, unquote, splittype, splithost, quote, + addinfourl, splitport, splittag, toBytes, + splitattr, ftpwrapper, splituser, splitpasswd, splitvalue) +@@ -120,11 +128,30 @@ + __version__ = sys.version[:3] + + _opener = None +-def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): ++def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, ++ cafile=None, capath=None, cadefault=False, context=None): + global _opener +- if _opener is None: +- _opener = build_opener() +- return _opener.open(url, data, timeout) ++ if cafile or capath or cadefault: ++ if context is not None: ++ raise ValueError( ++ "You can't pass both context and any of cafile, capath, and " ++ "cadefault" ++ ) ++ if not _have_ssl: ++ raise ValueError('SSL support not available') ++ context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH, ++ cafile=cafile, ++ capath=capath) ++ https_handler = HTTPSHandler(context=context) ++ opener = build_opener(https_handler) ++ elif context: ++ https_handler = HTTPSHandler(context=context) ++ opener = build_opener(https_handler) ++ elif _opener is None: ++ _opener = opener = build_opener() ++ else: ++ opener = _opener ++ return opener.open(url, data, timeout) + + def install_opener(opener): + global _opener +@@ -843,10 +870,7 @@ + password_mgr = HTTPPasswordMgr() + self.passwd = password_mgr + self.add_password = self.passwd.add_password +- self.retried = 0 + +- def reset_retry_count(self): +- self.retried = 0 + + def http_error_auth_reqed(self, authreq, host, req, headers): + # host may be an authority (without userinfo) or a URL with an +@@ -854,13 +878,6 @@ + # XXX could be multiple headers + authreq = headers.get(authreq, None) + +- if self.retried > 5: +- # retry sending the username:password 5 times before failing. +- raise HTTPError(req.get_full_url(), 401, "basic auth failed", +- headers, None) +- else: +- self.retried += 1 +- + if authreq: + mo = AbstractBasicAuthHandler.rx.search(authreq) + if mo: +@@ -869,17 +886,14 @@ + warnings.warn("Basic Auth Realm was unquoted", + UserWarning, 2) + if scheme.lower() == 'basic': +- response = self.retry_http_basic_auth(host, req, realm) +- if response and response.code != 401: +- self.retried = 0 +- return response ++ return self.retry_http_basic_auth(host, req, realm) + + def retry_http_basic_auth(self, host, req, realm): + user, pw = self.passwd.find_user_password(realm, host) + if pw is not None: + raw = "%s:%s" % (user, pw) + auth = 'Basic %s' % base64.b64encode(raw).strip() +- if req.headers.get(self.auth_header, None) == auth: ++ if req.get_header(self.auth_header, None) == auth: + return None + req.add_unredirected_header(self.auth_header, auth) + return self.parent.open(req, timeout=req.timeout) +@@ -895,7 +909,6 @@ + url = req.get_full_url() + response = self.http_error_auth_reqed('www-authenticate', + url, req, headers) +- self.reset_retry_count() + return response + + +@@ -911,7 +924,6 @@ + authority = req.get_host() + response = self.http_error_auth_reqed('proxy-authenticate', + authority, req, headers) +- self.reset_retry_count() + return response + + +@@ -1136,7 +1148,7 @@ + + return request + +- def do_open(self, http_class, req): ++ def do_open(self, http_class, req, **http_conn_args): + """Return an addinfourl object for the request, using http_class. + + http_class must implement the HTTPConnection API from httplib. +@@ -1150,7 +1162,8 @@ + if not host: + raise URLError('no host given') + +- h = http_class(host, timeout=req.timeout) # will parse host:port ++ # will parse host:port ++ h = http_class(host, timeout=req.timeout, **http_conn_args) + h.set_debuglevel(self._debuglevel) + + headers = dict(req.unredirected_hdrs) +@@ -1218,8 +1231,13 @@ + if hasattr(httplib, 'HTTPS'): + class HTTPSHandler(AbstractHTTPHandler): + ++ def __init__(self, debuglevel=0, context=None): ++ AbstractHTTPHandler.__init__(self, debuglevel) ++ self._context = context ++ + def https_open(self, req): +- return self.do_open(httplib.HTTPSConnection, req) ++ return self.do_open(httplib.HTTPSConnection, req, ++ context=self._context) + + https_request = AbstractHTTPHandler.do_request_ + diff --git a/jython.install b/jython.install new file mode 100644 index 000000000000..831fbe358d98 --- /dev/null +++ b/jython.install @@ -0,0 +1,20 @@ +pre_install() { + /bin/true +} +post_install() { + echo "==> Please see /usr/share/doc/jython/README.ArchLinux" + echo "==> for important information about this package." +} +pre_upgrade() { + /bin/true +} +post_upgrade() { + echo "==> Please see /usr/share/doc/jython/README.ArchLinux" + echo "==> for important information about this package." +} +pre_remove() { + /bin/true +} +post_remove() { + /bin/true +} diff --git a/jython.sh b/jython.sh new file mode 100644 index 000000000000..6acce11dbdcd --- /dev/null +++ b/jython.sh @@ -0,0 +1 @@ +export PATH="/opt/jython/bin/:$PATH" |