[arch-commits] Commit in python-irc/repos (5 files)

Evangelos Foutras foutrelis at archlinux.org
Sat Sep 19 16:51:30 UTC 2015


    Date: Saturday, September 19, 2015 @ 18:51:30
  Author: foutrelis
Revision: 141010

archrelease: copy trunk to community-staging-any

Added:
  python-irc/repos/community-staging-any/
  python-irc/repos/community-staging-any/PKGBUILD
    (from rev 141009, python-irc/trunk/PKGBUILD)
  python-irc/repos/community-staging-any/jaraco.py
    (from rev 141009, python-irc/trunk/jaraco.py)
  python-irc/repos/community-staging-any/python-irc.install
    (from rev 141009, python-irc/trunk/python-irc.install)
  python-irc/repos/community-staging-any/python2-irc.install
    (from rev 141009, python-irc/trunk/python2-irc.install)

---------------------+
 PKGBUILD            |   69 ++++++++++++++++++++++++++++
 jaraco.py           |  122 ++++++++++++++++++++++++++++++++++++++++++++++++++
 python-irc.install  |   48 +++++++++++++++++++
 python2-irc.install |   48 +++++++++++++++++++
 4 files changed, 287 insertions(+)

Copied: python-irc/repos/community-staging-any/PKGBUILD (from rev 141009, python-irc/trunk/PKGBUILD)
===================================================================
--- community-staging-any/PKGBUILD	                        (rev 0)
+++ community-staging-any/PKGBUILD	2015-09-19 16:51:30 UTC (rev 141010)
@@ -0,0 +1,69 @@
+# $Id$
+# Maintainer: Kyle Keen <keenerd at gmail.com>
+# Contributor: Jelle van der Waa <jelle at vdwaa.nl>
+# Contributor: Pierre Chapuis <catwell at archlinux.us>
+# Contributor: Stefano Esposito <ragnarok at email.it>
+
+pkgbase=python-irc
+pkgname=('python-irc' 'python2-irc')
+pkgver=11.0.1
+pkgrel=2
+pkgdesc="IRC (Internet Relay Chat) protocol client library for Python"
+depends=('python-six')
+makedepends=('python-setuptools' 'python2-setuptools')
+checkdepends=('python-pytest' 'python2-pytest')
+arch=('any')
+url="http://pypi.python.org/pypi/irc"
+license=('LGPL')
+install='python-irc.install'
+source=(http://pypi.python.org/packages/source/i/irc/irc-$pkgver.zip
+        jaraco.py)
+md5sums=('391088628b92b5a5ad48e2fefa4feab1'
+         '0577cd2b5ffe3907b9b7ce60aa422bb6')
+
+build() {
+  cd "$srcdir"
+  # todo, convince author not to use his own misc lib
+  cp jaraco.py "irc-$pkgver/irc/"
+  pushd "irc-$pkgver"
+  sed -i 's/jaraco.util.itertools/irc.jaraco/' irc/client.py
+  sed -i 's/jaraco.util.string/irc.jaraco/'    irc/strings.py
+  sed -i 's/jaraco.util.dictlib/irc.jaraco/'   irc/dict.py
+  sed -i '25i irc/jaraco.py' irc.egg-info/SOURCES.txt
+  sed -i "s/'jaraco.util',//" setup.py
+  echo "six" > irc.egg-info/requires.txt
+  popd
+  cp -a "irc-$pkgver" "irc2-$pkgver"
+}
+
+package_python2-irc()
+{
+  depends=('python2-six')
+  install='python2-irc.install'
+
+  cd "$srcdir/irc2-$pkgver"
+  python2 setup.py install --root="$pkgdir" --optimize=0
+  find "$pkgdir/" -name '*.pyc' -delete
+}
+
+package_python-irc()
+{
+  depends=('python-six')
+  install='python-irc.install'
+
+  cd "$srcdir/irc-$pkgver"
+  export LC_ALL=en_US.UTF-8
+  python3 setup.py install --root="$pkgdir" --optimize=0
+  find "$pkgdir/" -name '*.pyc' -delete
+  find "$pkgdir/" -type d -empty -delete
+}
+
+check()
+{
+  cd "$srcdir/irc-$pkgver"
+  export LC_ALL=en_US.UTF-8
+  python3 setup.py test 
+
+  cd "$srcdir/irc2-$pkgver"
+  python2 setup.py test 
+}

Copied: python-irc/repos/community-staging-any/jaraco.py (from rev 141009, python-irc/trunk/jaraco.py)
===================================================================
--- community-staging-any/jaraco.py	                        (rev 0)
+++ community-staging-any/jaraco.py	2015-09-19 16:51:30 UTC (rev 141010)
@@ -0,0 +1,122 @@
+"""
+Sometimes parts of https://pypi.python.org/pypi/jaraco.util
+leak into the python-irc package.  Instead of making a whole
+new package for these util functions, let's embed them
+instead.  Reconsider this when there is more than a dozen
+lines of code.
+
+He also says that "this grab-bag of routines is deprecated"
+"""
+
+import six
+
+# from jaraco.util.itertools import always_iterable
+def always_iterable(item):
+    "taken from jaraco.util-10.0.2"
+    if item is None:
+        item = ()
+    if isinstance(item, six.string_types) or not hasattr(item, '__iter__'):
+        item = (item,)
+    return item
+
+
+# from jaraco.util.string import FoldedCase
+class FoldedCase(six.text_type):
+    """
+    A case insensitive string class; behaves just like str
+    except compares equal when the only variation is case.
+    >>> s = FoldedCase('hello world')
+
+    >>> s == 'Hello World'
+    True
+
+    >>> 'Hello World' == s
+    True
+
+    >>> s.index('O')
+    4
+
+    >>> s.split('O')
+    ['hell', ' w', 'rld']
+
+    >>> sorted(map(FoldedCase, ['GAMMA', 'alpha', 'Beta']))
+    ['alpha', 'Beta', 'GAMMA']
+    """
+    def __lt__(self, other):
+        return self.lower() < other.lower()
+
+    def __gt__(self, other):
+        return self.lower() > other.lower()
+
+    def __eq__(self, other):
+        return self.lower() == other.lower()
+
+    def __hash__(self):
+        return hash(self.lower())
+
+    # cache lower since it's likely to be called frequently.
+    def lower(self):
+        self._lower = super(FoldedCase, self).lower()
+        self.lower = lambda: self._lower
+        return self._lower
+
+    def index(self, sub):
+        return self.lower().index(sub.lower())
+
+    def split(self, splitter=' ', maxsplit=0):
+        pattern = re.compile(re.escape(splitter), re.I)
+        return pattern.split(self, maxsplit)
+
+
+# from jaraco.util.dictlib import KeyTransformingDict
+class KeyTransformingDict(dict):
+    """
+    A dict subclass that transforms the keys before they're used.
+    Subclasses may override the default transform_key to customize behavior.
+    """
+    @staticmethod
+    def transform_key(key):
+        return key
+
+    def __init__(self, *args, **kargs):
+        super(KeyTransformingDict, self).__init__()
+        # build a dictionary using the default constructs
+        d = dict(*args, **kargs)
+        # build this dictionary using transformed keys.
+        for item in d.items():
+            self.__setitem__(*item)
+
+    def __setitem__(self, key, val):
+        key = self.transform_key(key)
+        super(KeyTransformingDict, self).__setitem__(key, val)
+
+    def __getitem__(self, key):
+        key = self.transform_key(key)
+        return super(KeyTransformingDict, self).__getitem__(key)
+
+    def __contains__(self, key):
+        key = self.transform_key(key)
+        return super(KeyTransformingDict, self).__contains__(key)
+
+    def __delitem__(self, key):
+        key = self.transform_key(key)
+        return super(KeyTransformingDict, self).__delitem__(key)
+
+    def setdefault(self, key, *args, **kwargs):
+        key = self.transform_key(key)
+        return super(KeyTransformingDict, self).setdefault(key, *args, **kwargs)
+
+    def pop(self, key, *args, **kwargs):
+        key = self.transform_key(key)
+        return super(KeyTransformingDict, self).pop(key, *args, **kwargs)
+
+    def matching_key_for(self, key):
+        """
+        Given a key, return the actual key stored in self that matches.
+        Raise KeyError if the key isn't found.
+        """
+        try:
+            return next(e_key for e_key in self.keys() if e_key == key)
+        except StopIteration:
+            raise KeyError(key)
+

Copied: python-irc/repos/community-staging-any/python-irc.install (from rev 141009, python-irc/trunk/python-irc.install)
===================================================================
--- community-staging-any/python-irc.install	                        (rev 0)
+++ community-staging-any/python-irc.install	2015-09-19 16:51:30 UTC (rev 141010)
@@ -0,0 +1,48 @@
+
+# clean up for anyone silly enough to run this as root
+
+# it would be great if pkgname and not just pkgver was passed in the arg list
+
+_pkg='python-irc'
+_cpython='cpython-34'
+
+post_upgrade() {
+  while read _f; do
+    if [[ "${_f:(-3)}" != ".py" ]]; then
+      continue
+    fi
+    if [[ ! -f "$_f" ]]; then
+      continue
+    fi
+    if [[ -e "${_f}c" ]]; then
+      rm -f "${_f}c"
+    fi
+    if [[ -e "${_f}o" ]]; then
+      rm -f "${_f}o"
+    fi
+    _thisdir="$(dirname "$_f")/__pycache__"
+    if [[ ! -d "$_thisdir" ]]; then
+      continue
+    fi
+    _thisfile="$(basename "$_f")"
+    _thisfile="${_thisfile/%.py/.${_cpython}.py}"
+    if [[ -e "${_thisdir}/${_thisfile}c" ]]; then
+      rm -f "${_thisdir}/${_thisfile}c"
+    fi
+    if [[ -e "${_thisdir}/${_thisfile}o" ]]; then
+      rm -f "${_thisdir}/${_thisfile}o"
+    fi
+    # no good way to test for empty dir
+    # would be 25% faster if there were
+    rmdir --ignore-fail-on-non-empty "$_thisdir" &> /dev/null
+  done <<<  "$(pacman -Qql $_pkg | grep '\.py$')"
+}
+
+post_install() {
+  post_upgrade $1
+}
+
+pre_remove() {
+  post_upgrade $1
+}
+

Copied: python-irc/repos/community-staging-any/python2-irc.install (from rev 141009, python-irc/trunk/python2-irc.install)
===================================================================
--- community-staging-any/python2-irc.install	                        (rev 0)
+++ community-staging-any/python2-irc.install	2015-09-19 16:51:30 UTC (rev 141010)
@@ -0,0 +1,48 @@
+
+# clean up for anyone silly enough to run this as root
+
+# it would be great if pkgname and not just pkgver was passed in the arg list
+
+_pkg='python2-irc'
+_cpython='cpython-34'
+
+post_upgrade() {
+  while read _f; do
+    if [[ "${_f:(-3)}" != ".py" ]]; then
+      continue
+    fi
+    if [[ ! -f "$_f" ]]; then
+      continue
+    fi
+    if [[ -e "${_f}c" ]]; then
+      rm -f "${_f}c"
+    fi
+    if [[ -e "${_f}o" ]]; then
+      rm -f "${_f}o"
+    fi
+    _thisdir="$(dirname "$_f")/__pycache__"
+    if [[ ! -d "$_thisdir" ]]; then
+      continue
+    fi
+    _thisfile="$(basename "$_f")"
+    _thisfile="${_thisfile/%.py/.${_cpython}.py}"
+    if [[ -e "${_thisdir}/${_thisfile}c" ]]; then
+      rm -f "${_thisdir}/${_thisfile}c"
+    fi
+    if [[ -e "${_thisdir}/${_thisfile}o" ]]; then
+      rm -f "${_thisdir}/${_thisfile}o"
+    fi
+    # no good way to test for empty dir
+    # would be 25% faster if there were
+    rmdir --ignore-fail-on-non-empty "$_thisdir" &> /dev/null
+  done <<<  "$(pacman -Qql $_pkg | grep '\.py$')"
+}
+
+post_install() {
+  post_upgrade $1
+}
+
+pre_remove() {
+  post_upgrade $1
+}
+



More information about the arch-commits mailing list