Merge remote-tracking branch 'upstream/staging' into deps-reorg

This commit is contained in:
John Ericson
2017-09-28 12:32:57 -04:00
789 changed files with 15725 additions and 8096 deletions

View File

@@ -1,19 +1,20 @@
{ stdenv, buildPythonPackage, fetchFromGitHub
, isPy3k , dbacl, notmuch, chardet, subprocess32 }:
, isPy3k , setuptools_scm, notmuch, chardet, subprocess32 }:
buildPythonPackage rec {
pname = "afew";
version = "git-2017-02-08";
version = "1.2.0";
name = "${pname}-${version}";
src = fetchFromGitHub {
owner = "afewmail";
repo = "afew";
rev = "889a3b966835c4d16aa1f24bb89f12945b9b2a67";
sha256 = "01gwrx1m3ka13ps3vj04a3y8llli2j2vkd3gcggcvxdphhpysckm";
rev = "3405475276a2433e1238be330e538ebf2a976e5e";
sha256 = "1h974avnfc6636az130yjqwm28z3aaqm49bjhpy3razx6zvyhzlf";
};
buildInputs = [ dbacl ];
buildInputs = [ setuptools_scm ];
SETUPTOOLS_SCM_PRETEND_VERSION = "${version}";
propagatedBuildInputs = [
notmuch
@@ -22,10 +23,6 @@ buildPythonPackage rec {
doCheck = false;
preConfigure = ''
substituteInPlace afew/DBACL.py --replace "'dbacl'" "'${dbacl}/bin/dbacl'"
'';
postInstall = ''
wrapProgram $out/bin/afew \
--prefix LD_LIBRARY_PATH : ${notmuch}/lib

View File

@@ -0,0 +1,21 @@
{ stdenv, buildPythonPackage, fetchPypi, six, wcwidth }:
buildPythonPackage rec {
name = "${pname}-${version}";
pname = "blessed";
version = "1.14.2";
src = fetchPypi {
inherit pname version;
sha256 = "0fv9f0074kxy1849h0kwwxw12sifpq3bv63pcz900zzjsigi4hi3";
};
propagatedBuildInputs = [ wcwidth six ];
meta = with stdenv.lib; {
homepage = https://github.com/jquast/blessed;
description = "A thin, practical wrapper around terminal capabilities in Python.";
maintainers = with maintainers; [ eqyiel ];
license = licenses.mit;
};
}

View File

@@ -0,0 +1,23 @@
{ stdenv, buildPythonPackage, fetchPypi }:
buildPythonPackage rec {
pname = "cement";
name = "${pname}-${version}";
version = "2.8.2";
src = fetchPypi {
inherit pname version;
sha256 = "1li2whjzfhbpg6fjb6r1r92fb3967p1xv6hqs3j787865h2ysrc7";
};
# Disable test tests since they depend on a memcached server running on
# 127.0.0.1:11211.
doCheck = false;
meta = with stdenv.lib; {
homepage = http://builtoncement.com/;
description = "A CLI Application Framework for Python.";
maintainers = with maintainers; [ eqyiel ];
license = licenses.bsd3;
};
}

View File

@@ -10,6 +10,8 @@ if isPyPy then null else buildPythonPackage rec {
sha256 = "1mffyilq4qycm8gs4wkgb18rnqil8a9blqq77chdlshzxc8jkc5k";
};
outputs = [ "out" "dev" ];
propagatedBuildInputs = [ libffi pycparser ];
buildInputs = [ pytest ];

View File

@@ -1,14 +1,14 @@
{ stdenv, buildPythonPackage, fetchurl,
{ stdenv, buildPythonPackage, fetchPypi,
asgiref, django, daphne
}:
buildPythonPackage rec {
pname = "channels";
name = "${pname}-${version}";
version = "1.1.6";
version = "1.1.8";
src = fetchurl {
url = "mirror://pypi/c/channels/${name}.tar.gz";
sha256 = "44ab9a1f610ecc9ac25d5f90e7a44f49b18de28a05a26fe34e935af257f1eefe";
src = fetchPypi {
inherit pname version;
sha256 = "0gsy3hwn1vd709jkw8ay44qrm6aw7qggr312z8xwzq0x4ihjda02";
};
# Files are missing in the distribution

View File

@@ -0,0 +1,32 @@
{ stdenv, buildPythonPackage, fetchPypi, isPy3k
, glibcLocales, pytest }:
buildPythonPackage rec {
pname = "ephem";
name = "${pname}-${version}";
version = "3.7.6.0";
src = fetchPypi {
inherit pname version;
sha256 = "7a4c82b1def2893e02aec0394f108d24adb17bd7b0ca6f4bc78eb7120c0212ac";
};
patchFlags = "-p0";
checkInputs = [ pytest glibcLocales ];
# JPLTest uses assets not distributed in package
checkPhase = ''
LC_ALL="en_US.UTF-8" py.test --pyargs ephem.tests -k "not JPLTest"
'';
# Unfortunately, the tests are broken for Python 3 in 3.7.6.0. They have been
# fixed in https://github.com/brandon-rhodes/pyephem/commit/c8633854e2d251a198b0f701d0528b508baa2411
# but there has not been a new release since then.
doCheck = !isPy3k;
meta = with stdenv.lib; {
description = "Compute positions of the planets and stars";
homepage = https://pypi.python.org/pypi/ephem/;
license = licenses.lgpl3;
maintainers = with maintainers; [ chrisrosset ];
};
}

View File

@@ -0,0 +1,20 @@
{ lib, fetchFromGitHub, buildPythonPackage, python, flake8, six }:
buildPythonPackage rec {
pname = "flake8-future-import";
name = "${pname}-${version}";
version = "0.4.3";
# PyPI tarball doesn't include the test suite
src = fetchFromGitHub {
owner = "xZise";
repo = "flake8-future-import";
rev = version;
sha256 = "0622bdcfa588m7g8igag6hf4rhjdwh74yfnrjwlxw4vlqhg344k4";
};
propagatedBuildInputs = [ flake8 six ];
meta = {
homepage = https://github.com/xZise/flake8-future-import;
description = "A flake8 extension to check for the imported __future__ modules to make it easier to have a consistent code base";
license = lib.licenses.mit;
};
}

View File

@@ -0,0 +1,20 @@
{ buildPythonPackage, fetchPypi, python
, pytest, pytestcov, watchdog, mock
}:
buildPythonPackage rec {
pname = "hupper";
version = "1.0";
name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
sha256 = "02lj6kgaf9xpr0binxwac3gpdhljglyj9fr78s165jc7qd7mifdg";
};
checkPhase = ''
py.test
'';
checkInputs = [ pytest pytestcov watchdog mock ];
}

View File

@@ -2,24 +2,34 @@
, pbr, testtools, testresources, testrepository, mock
, pep8, fixtures, mox3, requests-mock
, iso8601, requests, six, stevedore, webob, oslo-config
, pyyaml, betamax, oauthlib
}:
buildPythonPackage rec {
pname = "keystoneauth1";
version = "3.1.0";
version = "3.2.0";
name = "${pname}-${version}";
disabled = isPyPy; # a test fails
src = fetchPypi {
inherit pname version;
sha256 = "e5abfa8bbe866d52ca56afbe528d15214a60033cc1dc9804478cae7424f0f8fb";
sha256 = "0rg3harfyvai34lrjiqnl1crmvswjvj8nsviasnz4b9pcvp3d03n";
};
buildInputs = [ pbr testtools testresources testrepository mock
pep8 fixtures mox3 requests-mock ];
propagatedBuildInputs = [ iso8601 requests six stevedore
webob oslo-config ];
buildInputs = [ pbr ];
checkInputs = [ pyyaml betamax oauthlib testtools testresources
testrepository mock pep8 fixtures mox3 requests-mock ];
propagatedBuildInputs = [ iso8601 requests six stevedore webob ];
doCheck = true;
# 1. oslo-config
# 2. oslo-utils
# 3. requests-kerberos
preCheck = ''
rm keystoneauth1/tests/unit/loading/test_{session,conf,adapter}.py
rm keystoneauth1/tests/unit/access/test_v{2,3}_access.py
rm keystoneauth1/tests/unit/extras/kerberos/test_fedkerb_loading.py
'';
postPatch = ''
sed -i 's@python@${python.interpreter}@' .testr.conf
substituteInPlace requirements.txt --replace "argparse" ""

View File

@@ -1,16 +1,17 @@
{ buildPythonPackage, fetchPypi, pbr, six, netaddr, stevedore, mock }:
{ lib, buildPythonPackage, fetchPypi, pbr, six, netaddr, stevedore, mock,
debtcollector, rfc3986, pyyaml, oslo-i18n }:
buildPythonPackage rec {
pname = "oslo.config";
version = "4.11.0";
version = "4.12.0";
name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
sha256 = "1be8aaba466a3449fdb21ee8f7025b0d3d252c8c7568b8d5d05ceff58617cd05";
sha256 = "1pa9lajsadyq47bmxx12dxlcmnqsqlgnb55hwqas26lgnb2073dx";
};
propagatedBuildInputs = [ pbr six netaddr stevedore ];
propagatedBuildInputs = [ pbr six netaddr stevedore debtcollector rfc3986 pyyaml oslo-i18n ];
buildInputs = [ mock ];
# TODO: circular import on oslo-i18n
@@ -20,6 +21,12 @@ buildPythonPackage rec {
substituteInPlace requirements.txt --replace "argparse" ""
'';
# Requires a bunch of new packages
meta.broken = true;
meta = with lib; {
description = "Oslo Configuration API";
homepage = "https://docs.openstack.org/oslo.config/latest/";
license = licenses.asl20;
maintainers = with maintainers; [ makefu ];
};
}

View File

@@ -0,0 +1,24 @@
{ lib, buildPythonPackage, youtube-dl, fetchPypi }:
buildPythonPackage rec {
name = "${pname}-${version}";
pname = "pafy";
version = "0.5.3.1";
src = fetchPypi {
inherit pname version;
sha256 = "1a7dxi95m1043rxx1r5x3ngb66nwlq6aqcasyqqjzmmmjps4zrim";
};
# No tests included in archive
doCheck = false;
propagatedBuildInputs = [ youtube-dl ];
meta = with lib; {
description = "A library to download YouTube content and retrieve metadata";
homepage = http://np1.github.io/pafy/;
license = licenses.lgpl3Plus;
maintainers = with maintainers; [ odi ];
};
}

View File

@@ -2,12 +2,12 @@
buildPythonPackage rec {
pname = "phonenumbers";
version = "8.8.1";
version = "8.8.2";
name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
sha256 = "09f4b307v6wn5zs6spvp5icwad3dz9baf7d14hyvpnxn7cdqj2xy";
sha256 = "0xwis5hvp2wmnzqxax8896vhyb3q2fs9l9ilvyr44jdh3342dxpx";
};
meta = {

View File

@@ -0,0 +1,22 @@
{ buildPythonPackage, fetchPypi, python
, plaster, PasteDeploy
, pytest, pytestcov
}:
buildPythonPackage rec {
pname = "plaster_pastedeploy";
version = "0.4.1";
name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
sha256 = "1lrbkya5birfmg9gnfcnsa9id28klmjcqbm33rcg69pv9sfld4jv";
};
checkPhase = ''
py.test
'';
propagatedBuildInputs = [ plaster PasteDeploy ];
checkInputs = [ pytest pytestcov ];
}

View File

@@ -0,0 +1,20 @@
{ buildPythonPackage, fetchPypi, python
, pytest, pytestcov
}:
buildPythonPackage rec {
pname = "plaster";
version = "0.5";
name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
sha256 = "0z48pis4qyhyqj3ia82r04diaa153dw66wrpbly06hdzvhw8j0ia";
};
checkPhase = ''
py.test
'';
checkInputs = [ pytest pytestcov ];
}

View File

@@ -0,0 +1,24 @@
{ lib
, buildPythonPackage
, fetchPypi
}:
buildPythonPackage rec {
pname = "pyblake2";
version = "0.9.3";
name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
sha256 = "626448e1fe1cc01d2197118954bec9f158378577e12686d5b01979f7f0fa2212";
};
# requires setting up sphinx doctest
doCheck = false;
meta = {
description = "BLAKE2 hash function extension module";
license = lib.licenses.publicDomain;
homepage = https://github.com/dchest/pyblake2;
};
}

View File

@@ -17,7 +17,8 @@ buildPythonPackage rec {
substituteInPlace gnupg.py \
--replace "gpgbinary='gpg'" "gpgbinary='${gnupg1}/bin/gpg'"
substituteInPlace test_gnupg.py \
--replace "gpgbinary=GPGBINARY" "gpgbinary='${gnupg1}/bin/gpg'"
--replace "gpgbinary=GPGBINARY" "gpgbinary='${gnupg1}/bin/gpg'" \
--replace "test_search_keys" "disabled__test_search_keys"
'';
meta = with stdenv.lib; {

View File

@@ -1,4 +1,4 @@
{ stdenv, buildPythonPackage, fetchFromGitHub, libxml2
{ stdenv, buildPythonPackage, fetchFromGitHub, fetchpatch, libxml2
, m2crypto, ply, pyyaml, six
, httpretty, lxml, mock, pytest, requests
}:
@@ -14,6 +14,12 @@ buildPythonPackage rec {
sha256 = "0jcwklip03xcni0dvsk9va8ilqz21g4fxwqd5kzvv91slaadfcym";
};
patches = [
# fix timezone handling so the tests pass again. Can go when 0.10.1 is released
# https://github.com/pywbem/pywbem/issues/755#issuecomment-327508681
./make_cimdatetime_timezone_aware.patch
];
propagatedBuildInputs = [ m2crypto ply pyyaml six ];
checkInputs = [ httpretty lxml mock pytest requests ];

View File

@@ -0,0 +1,491 @@
From bb7fa19d636d999bf844d80939e155b8f212ef3e Mon Sep 17 00:00:00 2001
From: Andreas Maier <maiera@de.ibm.com>
Date: Fri, 23 Jun 2017 19:13:51 +0200
Subject: [PATCH] Made CIMDateTime always timezone-aware, re-enabled
test_cim_types.py
Details:
- Ensured that 'CIMDateTime' objects for point in time values are
timezone-aware when supplied with a timezone-naive 'datetime'
object. This does not change the behavior, but increases code
clarity.
- Clarified that in the documentation of 'CIMDateTime'.
- Added testcases for CIMDateTime.
- Re-enabled the testing of test_cim_types.py. Since its change
to using pytest it was not run because the test methods were
all static methods which apparently does not work. Not sure
this ever worked.
Signed-off-by: Andreas Maier <maiera@de.ibm.com>
---
docs/changes.rst | 5 +
pywbem/cim_types.py | 22 +--
testsuite/test_cim_types.py | 369 +++++++++++++++++++++++---------------------
3 files changed, 207 insertions(+), 189 deletions(-)
diff --git a/docs/changes.rst b/docs/changes.rst
index 272ed30d..6fdfbcf4 100644
--- a/docs/changes.rst
+++ b/docs/changes.rst
@@ -72,6 +72,11 @@ Enhancements
* Added unit test for recorder. See issue #676
+* Ensured that `CIMDateTime` objects for point in time values are
+ timezone-aware when supplied with a timezone-naive `datetime` object.
+ This does not change the behavior, but increases code clarity.
+ Clarified that in the documentation of `CIMDateTime`. See issue #698.
+
Bug fixes
^^^^^^^^^
diff --git a/pywbem/cim_types.py b/pywbem/cim_types.py
index 6d1f140c..5ecc7707 100644
--- a/pywbem/cim_types.py
+++ b/pywbem/cim_types.py
@@ -74,6 +74,7 @@
import re
import warnings
import six
+import copy
from . import config
@@ -294,9 +295,11 @@ def __init__(self, dtarg):
* A :term:`string` object will be
interpreted as CIM datetime format (see :term:`DSP0004`) and
will result in a point in time or a time interval.
- * A :class:`py:datetime.datetime` object must be timezone-aware
- (see :class:`~pywbem.MinutesFromUTC`) and will result in a point
- in time.
+ * A :class:`py:datetime.datetime` object will result in a point
+ in time. If the :class:`py:datetime.datetime` object is
+ timezone-aware (see :class:`~pywbem.MinutesFromUTC`), the
+ specified timezone will be used. Otherwise, a default timezone
+ of UTC will be assumed.
* A :class:`py:datetime.timedelta` object will result in a time
interval.
* Another :class:`~pywbem.CIMDateTime` object will be copied.
@@ -342,14 +345,15 @@ def __init__(self, dtarg):
raise ValueError('dtarg argument "%s" has an invalid CIM '
'datetime format' % dtarg)
elif isinstance(dtarg, datetime):
- self.__datetime = dtarg
+ if dtarg.tzinfo is None:
+ self.__datetime = dtarg.replace(tzinfo=MinutesFromUTC(0))
+ else:
+ self.__datetime = copy.copy(dtarg)
elif isinstance(dtarg, timedelta):
- self.__timedelta = dtarg
+ self.__timedelta = copy.copy(dtarg)
elif isinstance(dtarg, CIMDateTime):
- # pylint: disable=protected-access
- self.__datetime = dtarg.__datetime
- # pylint: disable=protected-access
- self.__timedelta = dtarg.__timedelta
+ self.__datetime = copy.copy(dtarg.datetime)
+ self.__timedelta = copy.copy(dtarg.timedelta)
else:
raise TypeError('dtarg argument "%s" has an invalid type: %s '
'(expected datetime, timedelta, string, or '
diff --git a/testsuite/test_cim_types.py b/testsuite/test_cim_types.py
index 4ae354d3..b1f54d06 100755
--- a/testsuite/test_cim_types.py
+++ b/testsuite/test_cim_types.py
@@ -43,105 +43,99 @@ def integer_tuple(request):
return request.param
-class TestIntegers:
- """
- Test CIM integer data type classes.
- """
-
- @staticmethod
- def test_class_attrs_class(integer_tuple):
- """Test class attrs via class level"""
- obj_type, exp_cimtype, exp_minvalue, exp_maxvalue = integer_tuple
- assert obj_type.cimtype == exp_cimtype
- assert obj_type.minvalue == exp_minvalue
- assert obj_type.maxvalue == exp_maxvalue
-
- @staticmethod
- def test_class_attrs_inst(integer_tuple):
- """Test class attrs via instance level"""
- obj_type, exp_cimtype, exp_minvalue, exp_maxvalue = integer_tuple
- obj = obj_type(42)
- assert obj.cimtype == exp_cimtype
- assert obj.minvalue == exp_minvalue
- assert obj.maxvalue == exp_maxvalue
-
- @staticmethod
- def test_inheritance(integer_tuple):
- """Test inheritance"""
- obj_type = integer_tuple[0]
- obj = obj_type(42)
- assert isinstance(obj, obj_type)
- assert isinstance(obj, CIMType)
- assert isinstance(obj, CIMInt)
- assert not isinstance(obj, CIMFloat)
-
- @staticmethod
- def test_init_int(integer_tuple):
- """Test initialization from integer value"""
- obj_type = integer_tuple[0]
- obj = obj_type(42)
- assert obj == 42
-
- @staticmethod
- def test_init_str(integer_tuple):
- """Test initialization from string value"""
- obj_type = integer_tuple[0]
- obj = obj_type('42')
- assert obj == 42
-
- @staticmethod
- def test_init_str_base10(integer_tuple):
- """Test initialization from string value with base 10"""
- obj_type = integer_tuple[0]
- obj = obj_type('42', 10)
- assert obj == 42
-
- @staticmethod
- def test_init_str_base16(integer_tuple):
- """Test initialization from string value with base 16"""
- obj_type = integer_tuple[0]
- obj = obj_type('2A', 16)
- assert obj == 42
-
- @staticmethod
- def test_init_minimum(integer_tuple):
- """Test initialization from integer value at minimum"""
- obj_type = integer_tuple[0]
- exp_minvalue = integer_tuple[2]
- obj = obj_type(exp_minvalue)
- assert obj == exp_minvalue
-
- @staticmethod
- def test_init_maximum(integer_tuple):
- """Test initialization from integer value at maximum"""
- obj_type = integer_tuple[0]
- exp_maxvalue = integer_tuple[3]
- obj = obj_type(exp_maxvalue)
- assert obj == exp_maxvalue
-
- @staticmethod
- def test_init_too_low(integer_tuple):
- """Test initialization from integer value below minimum"""
- obj_type = integer_tuple[0]
- exp_minvalue = integer_tuple[2]
- try:
- obj_type(exp_minvalue - 1)
- except ValueError:
- pass
- else:
- raise AssertionError("ValueError was not raised.")
-
- @staticmethod
- def test_init_too_high(integer_tuple):
- """Test initialization from integer value above maximum"""
- obj_type = integer_tuple[0]
- exp_maxvalue = integer_tuple[3]
- try:
- obj_type(exp_maxvalue + 1)
- except ValueError:
- pass
- else:
- raise AssertionError("ValueError was not raised.")
+def test_integer_class_attrs_class(integer_tuple):
+ """Test class attrs via class level"""
+ obj_type, exp_cimtype, exp_minvalue, exp_maxvalue = integer_tuple
+ assert obj_type.cimtype == exp_cimtype
+ assert obj_type.minvalue == exp_minvalue
+ assert obj_type.maxvalue == exp_maxvalue
+
+
+def test_integer_class_attrs_inst(integer_tuple):
+ """Test class attrs via instance level"""
+ obj_type, exp_cimtype, exp_minvalue, exp_maxvalue = integer_tuple
+ obj = obj_type(42)
+ assert obj.cimtype == exp_cimtype
+ assert obj.minvalue == exp_minvalue
+ assert obj.maxvalue == exp_maxvalue
+
+
+def test_integer_inheritance(integer_tuple):
+ """Test inheritance"""
+ obj_type = integer_tuple[0]
+ obj = obj_type(42)
+ assert isinstance(obj, obj_type)
+ assert isinstance(obj, CIMType)
+ assert isinstance(obj, CIMInt)
+ assert not isinstance(obj, CIMFloat)
+
+
+def test_integer_init_int(integer_tuple):
+ """Test initialization from integer value"""
+ obj_type = integer_tuple[0]
+ obj = obj_type(42)
+ assert obj == 42
+
+
+def test_integer_init_str(integer_tuple):
+ """Test initialization from string value"""
+ obj_type = integer_tuple[0]
+ obj = obj_type('42')
+ assert obj == 42
+
+
+def test_integer_init_str_base10(integer_tuple):
+ """Test initialization from string value with base 10"""
+ obj_type = integer_tuple[0]
+ obj = obj_type('42', 10)
+ assert obj == 42
+
+
+def test_integer_init_str_base16(integer_tuple):
+ """Test initialization from string value with base 16"""
+ obj_type = integer_tuple[0]
+ obj = obj_type('2A', 16)
+ assert obj == 42
+
+
+def test_integer_init_minimum(integer_tuple):
+ """Test initialization from integer value at minimum"""
+ obj_type = integer_tuple[0]
+ exp_minvalue = integer_tuple[2]
+ obj = obj_type(exp_minvalue)
+ assert obj == exp_minvalue
+
+
+def test_integer_init_maximum(integer_tuple):
+ """Test initialization from integer value at maximum"""
+ obj_type = integer_tuple[0]
+ exp_maxvalue = integer_tuple[3]
+ obj = obj_type(exp_maxvalue)
+ assert obj == exp_maxvalue
+
+
+def test_integer_init_too_low(integer_tuple):
+ """Test initialization from integer value below minimum"""
+ obj_type = integer_tuple[0]
+ exp_minvalue = integer_tuple[2]
+ try:
+ obj_type(exp_minvalue - 1)
+ except ValueError:
+ pass
+ else:
+ raise AssertionError("ValueError was not raised.")
+
+
+def test_integer_init_too_high(integer_tuple):
+ """Test initialization from integer value above maximum"""
+ obj_type = integer_tuple[0]
+ exp_maxvalue = integer_tuple[3]
+ try:
+ obj_type(exp_maxvalue + 1)
+ except ValueError:
+ pass
+ else:
+ raise AssertionError("ValueError was not raised.")
#
@@ -164,47 +158,41 @@ def real_tuple(request):
return request.param
-class TestReals:
- """
- Test CIM real data type classes.
- """
-
- @staticmethod
- def test_class_attrs_class(real_tuple):
- """Test class attrs via class level"""
- obj_type, exp_cimtype = real_tuple
- assert obj_type.cimtype == exp_cimtype
-
- @staticmethod
- def test_class_attrs_inst(real_tuple):
- """Test class attrs via instance level"""
- obj_type, exp_cimtype = real_tuple
- obj = obj_type(42)
- assert obj.cimtype == exp_cimtype
-
- @staticmethod
- def test_inheritance(real_tuple):
- """Test inheritance"""
- obj_type = real_tuple[0]
- obj = obj_type(42)
- assert isinstance(obj, obj_type)
- assert isinstance(obj, CIMType)
- assert isinstance(obj, CIMFloat)
- assert not isinstance(obj, CIMInt)
-
- @staticmethod
- def test_init_float(real_tuple):
- """Test initialization from floating point value"""
- obj_type = real_tuple[0]
- obj = obj_type(42.0)
- assert obj == 42.0
-
- @staticmethod
- def test_init_str(real_tuple):
- """Test initialization from string value"""
- obj_type = real_tuple[0]
- obj = obj_type('42.0')
- assert obj == 42.0
+def test_real_class_attrs_class(real_tuple):
+ """Test class attrs via class level"""
+ obj_type, exp_cimtype = real_tuple
+ assert obj_type.cimtype == exp_cimtype
+
+
+def test_real_class_attrs_inst(real_tuple):
+ """Test class attrs via instance level"""
+ obj_type, exp_cimtype = real_tuple
+ obj = obj_type(42)
+ assert obj.cimtype == exp_cimtype
+
+
+def test_real_inheritance(real_tuple):
+ """Test inheritance"""
+ obj_type = real_tuple[0]
+ obj = obj_type(42)
+ assert isinstance(obj, obj_type)
+ assert isinstance(obj, CIMType)
+ assert isinstance(obj, CIMFloat)
+ assert not isinstance(obj, CIMInt)
+
+
+def test_real_init_float(real_tuple):
+ """Test initialization from floating point value"""
+ obj_type = real_tuple[0]
+ obj = obj_type(42.0)
+ assert obj == 42.0
+
+
+def test_real_init_str(real_tuple):
+ """Test initialization from string value"""
+ obj_type = real_tuple[0]
+ obj = obj_type('42.0')
+ assert obj == 42.0
#
@@ -271,6 +259,26 @@ def test_init_str(real_tuple):
'20140924193040.654321+120'
),
(
+ datetime(year=2014, month=9, day=24, hour=19, minute=30, second=40,
+ microsecond=654321, tzinfo=MinutesFromUTC(0)),
+ 'timestamp',
+ datetime(year=2014, month=9, day=24, hour=19, minute=30, second=40,
+ microsecond=654321, tzinfo=MinutesFromUTC(0)),
+ None,
+ 0,
+ '20140924193040.654321+000'
+ ),
+ (
+ datetime(year=2014, month=9, day=24, hour=19, minute=30, second=40,
+ microsecond=654321),
+ 'timestamp',
+ datetime(year=2014, month=9, day=24, hour=19, minute=30, second=40,
+ microsecond=654321, tzinfo=MinutesFromUTC(0)),
+ None,
+ 0,
+ '20140924193040.654321+000'
+ ),
+ (
'20140924193040.654321+120',
'timestamp',
datetime(year=2014, month=9, day=24, hour=19, minute=30, second=40,
@@ -325,46 +333,47 @@ def datetime_init_tuple(request):
return request.param
-class TestDatetime:
- """
- Test CIM real data type classes.
- """
-
- @staticmethod
- def test_class_attrs_class():
- """Test class attrs via class level"""
- assert CIMDateTime.cimtype == 'datetime'
-
- @staticmethod
- def test_class_attrs_inst():
- """Test class attrs via instance level"""
- obj = CIMDateTime('00000000000000.000000:000')
- assert obj.cimtype == 'datetime'
-
- @staticmethod
- def test_inheritance():
- """Test inheritance"""
- obj = CIMDateTime('00000000000000.000000:000')
- assert isinstance(obj, CIMDateTime)
- assert isinstance(obj, CIMType)
- assert not isinstance(obj, CIMFloat)
- assert not isinstance(obj, CIMInt)
-
- @staticmethod
- def test_init(datetime_init_tuple):
- """Test initialization from all input types"""
- (dtarg, exp_kind, exp_datetime, exp_timedelta, exp_minutesfromutc,
- exp_str) = datetime_init_tuple
- try:
- obj = CIMDateTime(dtarg)
- except Exception as exc:
- assert isinstance(exc, exp_kind)
- else:
- assert obj.is_interval == (exp_kind == 'interval')
- assert obj.datetime == exp_datetime
- assert obj.timedelta == exp_timedelta
- assert obj.minutes_from_utc == exp_minutesfromutc
- assert str(obj) == exp_str
+def test_datetime_class_attrs_class():
+ """Test class attrs via class level"""
+ assert CIMDateTime.cimtype == 'datetime'
+
+
+def test_datetime_class_attrs_inst():
+ """Test class attrs via instance level"""
+ obj = CIMDateTime('00000000000000.000000:000')
+ assert obj.cimtype == 'datetime'
+
+
+def test_datetime_inheritance():
+ """Test inheritance"""
+ obj = CIMDateTime('00000000000000.000000:000')
+ assert isinstance(obj, CIMDateTime)
+ assert isinstance(obj, CIMType)
+ assert not isinstance(obj, CIMFloat)
+ assert not isinstance(obj, CIMInt)
+
+
+def test_datetime_init(datetime_init_tuple):
+ """Test initialization from all input types"""
+ (dtarg, exp_kind, exp_datetime, exp_timedelta, exp_minutesfromutc,
+ exp_str) = datetime_init_tuple
+ try:
+ obj = CIMDateTime(dtarg)
+ except Exception as exc:
+ assert isinstance(exc, exp_kind)
+ else:
+ assert obj.is_interval == (exp_kind == 'interval')
+ assert obj.datetime == exp_datetime
+ if obj.datetime is not None:
+ assert isinstance(obj.datetime, datetime)
+ # We ensure that the datetime is always timezone-aware:
+ assert obj.datetime.tzinfo is not None
+ assert obj.timedelta == exp_timedelta
+ if obj.timedelta is not None:
+ assert isinstance(obj.timedelta, timedelta)
+ assert obj.minutes_from_utc == exp_minutesfromutc
+ assert str(obj) == exp_str
+
# TODO: Add testcases for get_local_utcoffset()
# TODO: Add testcases for now()

View File

@@ -0,0 +1,32 @@
{ lib
, buildPythonPackage
, fetchPypi
, requests
, betamax
, mock
, pytest
}:
buildPythonPackage rec {
pname = "requests-toolbelt";
version = "0.8.0";
name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
sha256 = "f6a531936c6fa4c6cfce1b9c10d5c4f498d16528d2a54a22ca00011205a187b5";
};
checkInputs = [ betamax mock pytest ];
propagatedBuildInputs = [ requests ];
checkPhase = ''
py.test tests
'';
meta = {
description = "A toolbelt of useful classes and functions to be used with python-requests";
homepage = http://toolbelt.rtfd.org;
maintainers = with lib.maintainers; [ matthiasbeyer jgeerds ];
};
}

View File

@@ -12,6 +12,8 @@ buildPythonPackage rec {
sha256 = "0zi3v9nsmv9j27d0c0m1dvqyvaxz53g8m0aa1h3qanxs4irkwi4w";
};
outputs = [ "out" "dev" ];
nativeBuildInputs = [ pytest ];
propagatedBuildInputs = [ urllib3 idna chardet certifi ];
# sadly, tests require networking

View File

@@ -0,0 +1,27 @@
{ lib, buildPythonPackage, fetchPypi, pbr }:
buildPythonPackage rec {
pname = "requestsexceptions";
version = "1.3.0";
name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
sha256 = "0gim00vi7vfq16y8b9m1vpy01grqvrdrbh88jb98qx6n6sk1n54g";
};
propagatedBuildInputs = [ pbr ];
# upstream hacking package is not required for functional testing
patchPhase = ''
sed -i '/^hacking/d' test-requirements.txt
'';
meta = with lib; {
description = "Import exceptions from potentially bundled packages in requests.";
homepage = "https://pypi.python.org/pypi/requestsexceptions";
license = licenses.asl20;
maintainers = with maintainers; [ makefu ];
patforms = platforms.all;
};
}

View File

@@ -0,0 +1,24 @@
{ stdenv, fetchFromGitHub, buildPythonPackage, pytest }:
buildPythonPackage rec {
pname = "simanneal";
version = "0.4.1";
name = "${pname}-${version}";
src = fetchFromGitHub {
owner = "perrygeo";
repo = "simanneal";
rev = version;
sha256 = "12499wvf7ii7cy8z2f1d472p7q9napg1lj0h9xx8l1mbr1hjlp3q";
};
checkInputs = [ pytest ];
checkPhase = "pytest tests";
meta = with stdenv.lib; {
description = "A python implementation of the simulated annealing optimization technique";
homepage = https://github.com/perrygeo/simanneal;
license = licenses.isc;
maintainers = with maintainers; [ veprbl ];
};
}

View File

@@ -12,7 +12,7 @@ buildPythonPackage rec {
sha256 = "0ld2bihp9kmf57ykgzrfgxs4j9kxlw79sgdj9sfn47snw3izb2p6";
};
checkInputs = [ unittest2 scripttest pytz pylint mock testtools ];
checkInputs = [ unittest2 scripttest pytz pylint mock testtools tempest-lib ];
propagatedBuildInputs = [ pbr tempita decorator sqlalchemy six sqlparse ];
checkPhase = ''
@@ -27,12 +27,12 @@ buildPythonPackage rec {
${python.interpreter} setup.py test
'';
# Tests require tempest-lib which requires the broken oslo-config
doCheck = false;
doCheck = true;
meta = with stdenv.lib; {
homepage = http://code.google.com/p/sqlalchemy-migrate/;
description = "Schema migration tools for SQLAlchemy";
license = licenses.asl20;
maintainers = with maintainers; [ makefu ];
};
}

View File

@@ -0,0 +1,38 @@
{ lib
, buildPythonPackage
, fetchPypi
, isPy3k
, isPyPy
, bash
, python
}:
buildPythonPackage rec {
pname = "subprocess32";
version = "3.2.7";
name = "${pname}-${version}";
disabled = isPy3k;
src = fetchPypi {
inherit pname version;
sha256 = "1e450a4a4c53bf197ad6402c564b9f7a53539385918ef8f12bdf430a61036590";
};
buildInputs = [ bash ];
preConfigure = ''
substituteInPlace test_subprocess32.py \
--replace '/usr/' '${bash}/'
'';
doCheck = !isPyPy;
checkPhase = ''
${python.interpreter} test_subprocess32.py
'';
meta = {
homepage = https://pypi.python.org/pypi/subprocess32;
description = "Backport of the subprocess module from Python 3.2.5 for use on 2.x";
maintainers = with lib.maintainers; [ garbas ];
};
}

View File

@@ -0,0 +1,43 @@
{ stdenv
, fetchPypi
, buildPythonPackage
, isPy3k
, bleach_1_5_0
, numpy
, werkzeug
, protobuf
, markdown
}:
# tensorflow is built from a downloaded wheel, because the upstream
# project's build system is an arcane beast based on
# bazel. Untangling it and building the wheel from source is an open
# problem.
buildPythonPackage rec {
pname = "tensorflow-tensorboard";
version = "0.1.5";
name = "${pname}-${version}";
format = "wheel";
src = fetchPypi ({
pname = "tensorflow_tensorboard";
inherit version;
format = "wheel";
} // (if isPy3k then {
python = "py3";
sha256 = "0sfia05y1mzgy371faj96vgzhag1rgpa3gnbz9w1fay13jryw26x";
} else {
python = "py2";
sha256 = "0qx4f55zp54x079kxir4zz5b1ckiglsdcb9afz5wcdj6af4a6czg";
}));
propagatedBuildInputs = [ bleach_1_5_0 numpy werkzeug protobuf markdown ];
meta = with stdenv.lib; {
description = "TensorFlow helps the tensors flow";
homepage = http://tensorflow.org;
license = licenses.asl20;
maintainers = with maintainers; [ abbradar ];
};
}

View File

@@ -1,7 +1,8 @@
{ stdenv
, lib
, fetchurl
, buildPythonPackage
, isPy36, isPy35, isPy27
, isPy3k, isPy35, isPy36, isPy27
, cudaSupport ? false
, cudatoolkit ? null
, cudnn ? null
@@ -9,10 +10,10 @@
, numpy
, six
, protobuf
, swig
, werkzeug
, mock
, backports_weakref
, zlib
, tensorflow-tensorboard
}:
assert cudaSupport -> cudatoolkit != null
@@ -29,10 +30,10 @@ assert ! (stdenv.isDarwin && cudaSupport);
buildPythonPackage rec {
pname = "tensorflow";
version = "1.1.0";
version = "1.3.0";
name = "${pname}-${version}";
format = "wheel";
disabled = ! (isPy36 || isPy35 || isPy27);
disabled = ! (isPy35 || isPy36 || isPy27);
src = let
tfurl = sys: proc: pykind:
@@ -47,69 +48,77 @@ buildPythonPackage rec {
darwin.cpu = {
py2 = {
url = tfurl "mac" "cpu" "py2-none-any" ;
sha256 = "1fgf26lw0liqxc9pywc8y2mj8l1mv48nhkav0pag9vavdacb9mqr";
sha256 = "0nkymqbqjx8rsmc8vkc26cfsg4hpr6lj9zrwhjnfizvkzbbsh5z4";
};
py3 = {
url = tfurl "mac" "cpu" "py3-none-any" ;
sha256 = "0z5p1fra7bih0vqn618i2w3vyy8d1rkc72k7bmjq0rw8msl717ia";
sha256 = "1rj4m817w3lajnb1lgn3bwfwwk3qwvypyx11dim1ybakbmsc1j20";
};
};
linux-x86_64.cpu = {
py2 = {
url = tfurl "linux" "cpu" "cp27-none-linux_x86_64";
sha256 = "0ld3hqx3idxk0zcrvn3p9yqnmx09zsj3mw66jlfw6fkv5hznx8j2";
sha256 = "09pcyx0yfil4dm6cij8n3907pfgva07a38avrbai4qk5h6hxm8w9";
};
py35 = {
url = tfurl "linux" "cpu" "cp35-cp35m-linux_x86_64";
sha256 = "0ahz9222rzqrk43lb9w4m351klkm6mlnnvw8xfqip28vbmymw90b";
sha256 = "0p10zcf41pi33bi025fibqkq9rpd3v0rrbdmc9i9yd7igy076a07";
};
py36 = {
url = tfurl "linux" "cpu" "cp36-cp36m-linux_x86_64";
sha256 = "1a2cc8ihl94iqff76nxg6bq85vfb7sj5cvvi9sxy2f43k32fi4lv";
sha256 = "1qm8lm2f6bf9d462ybgwrz0dn9i6cnisgwdvyq9ssmy2f1gp8hxk";
};
};
linux-x86_64.cuda = {
py2 = {
url = tfurl "linux" "gpu" "cp27-none-linux_x86_64";
sha256 = "1baa9jwr6f8f62dyx6isbw8yyrd0pi1dz1srjblfqsyk1x3pnfvh";
sha256 = "10yyyn4g2fsv1xgmw99bbr0fg7jvykay4gb5pxrrylh7h38h6wah";
};
py35 = {
url = tfurl "linux" "gpu" "cp35-cp35m-linux_x86_64";
sha256 = "0606m2awy0ifhniy8lsyhd0xc388dgrwksn87989xlgy90wpxi92";
sha256 = "0icwnhkcf3fxr6bmbihqzipnn4pxybd06qv7l3k0p4xdgycwzmzk";
};
py36 = {
url = tfurl "linux" "gpu" "cp36-cp36m-linux_x86_64";
sha256 = "0lvbmfa87qzrajadpsf13gi3l71vryzkryzqfvkykivqrdjsvj8q";
sha256 = "12g3akkr083gs3sisjbmm0lpsk8phn3dvy7jjfadfxshqc7za14i";
};
};
};
in
fetchurl (
if stdenv.isDarwin then
if isPy27 then
dls.darwin.cpu.py2
else
if isPy3k then
dls.darwin.cpu.py3
else if isPy36 then
if cudaSupport then
dls.linux-x86_64.cuda.py36
else dls.linux-x86_64.cpu.py36
else if isPy35 then
if cudaSupport then
dls.linux-x86_64.cuda.py35
else dls.linux-x86_64.cpu.py35
else
if cudaSupport then
dls.linux-x86_64.cuda.py2
else
dls.linux-x86_64.cpu.py2
dls.darwin.cpu.py2
else
if isPy35 then
if cudaSupport then
dls.linux-x86_64.cuda.py35
else
dls.linux-x86_64.cpu.py35
else if isPy36 then
if cudaSupport then
dls.linux-x86_64.cuda.py36
else
dls.linux-x86_64.cpu.py36
else
if cudaSupport then
dls.linux-x86_64.cuda.py2
else
dls.linux-x86_64.cpu.py2
);
propagatedBuildInputs = with stdenv.lib;
[ numpy six protobuf swig werkzeug mock ]
++ optionals cudaSupport [ cudatoolkit cudnn stdenv.cc ];
propagatedBuildInputs =
[ numpy six protobuf mock backports_weakref ]
++ lib.optional (!isPy36) tensorflow-tensorboard
++ lib.optionals cudaSupport [ cudatoolkit cudnn stdenv.cc ];
# tensorflow-gpu depends on tensorflow_tensorboard, which cannot be
# built at the moment (some of its dependencies do not build
# [htlm5lib9999999 (seven nines) -> tensorboard], and it depends on an old version of
# bleach) Hence we disable dependency checking for now.
installFlags = lib.optional isPy36 "--no-dependencies";
# Note that we need to run *after* the fixup phase because the
# libraries are loaded at runtime. If we run in preFixup then

View File

@@ -0,0 +1,32 @@
{ lib
, buildPythonPackage
, fetchPypi
, pkginfo
, requests
, requests_toolbelt
, tqdm
, pyblake2
}:
buildPythonPackage rec {
pname = "twine";
version = "1.9.1";
name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
sha256 = "caa45b7987fc96321258cd7668e3be2ff34064f5c66d2d975b641adca659c1ab";
};
propagatedBuildInputs = [ pkginfo requests requests_toolbelt tqdm pyblake2 ];
# Requires network
doCheck = false;
meta = {
description = "Collection of utilities for interacting with PyPI";
homepage = https://github.com/pypa/twine;
license = lib.licenses.asl20;
maintainer = with lib.maintainers; [ fridh ];
};
}