From cda313e3cc330b981cb3e8f712b5d9e8ef56ca87 Mon Sep 17 00:00:00 2001 From: IvarWithoutBones Date: Fri, 23 Oct 2020 03:16:36 +0200 Subject: [PATCH] pythonPackages.imdbpy: init at 2020.9.25 --- .../python-modules/imdbpy/default.nix | 25 ++++++++++++ .../python-modules/imdbpy/sql_error.patch | 39 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 66 insertions(+) create mode 100644 pkgs/development/python-modules/imdbpy/default.nix create mode 100644 pkgs/development/python-modules/imdbpy/sql_error.patch diff --git a/pkgs/development/python-modules/imdbpy/default.nix b/pkgs/development/python-modules/imdbpy/default.nix new file mode 100644 index 00000000000..dea62f08009 --- /dev/null +++ b/pkgs/development/python-modules/imdbpy/default.nix @@ -0,0 +1,25 @@ +{ lib, buildPythonPackage, fetchPypi, lxml, sqlalchemy }: + +buildPythonPackage rec { + pname = "IMDbPY"; + version = "2020.9.25"; + + src = fetchPypi { + inherit pname version; + sha256 = "1p3j9j1jcgbw4626cvgpryhvczy9gzlg0laz6lflgq17m129gin2"; + }; + + patches = [ ./sql_error.patch ]; # Already fixed in master, but not yet in the current release. This can be removed upon the next version update + + propagatedBuildInputs = [ lxml sqlalchemy ]; + + doCheck = false; # Tests require networking, and https://github.com/alberanid/imdbpy/issues/240 + pythonImportsCheck = [ "imdb" ]; + + meta = with lib; { + homepage = "https://imdbpy.github.io/"; + description = "A Python package for retrieving and managing the data of the IMDb database"; + maintainers = [ maintainers.ivar ]; + license = licenses.gpl2Only; + }; +} diff --git a/pkgs/development/python-modules/imdbpy/sql_error.patch b/pkgs/development/python-modules/imdbpy/sql_error.patch new file mode 100644 index 00000000000..10770f4f113 --- /dev/null +++ b/pkgs/development/python-modules/imdbpy/sql_error.patch @@ -0,0 +1,39 @@ +diff --git a/imdb/parser/sql/__init__.py b/imdb/parser/sql/__init__.py +index cd4a3e3..3fcfdd4 100644 +--- a/imdb/parser/sql/__init__.py ++++ b/imdb/parser/sql/__init__.py +@@ -557,7 +557,6 @@ class IMDbSqlAccessSystem(IMDbBase): + """The class used to access IMDb's data through a SQL database.""" + + accessSystem = 'sql' +- _sql_logger = logging.getLogger('imdbpy.parser.sql') + + def __init__(self, uri, adultSearch=True, *arguments, **keywords): + """Initialize the access system.""" +@@ -582,7 +581,7 @@ class IMDbSqlAccessSystem(IMDbBase): + except ImportError as e: + raise IMDbError('unable to import SQLAlchemy') + # Set the connection to the database. +- self._sql_logger.debug('connecting to %s', uri) ++ logger.debug('connecting to %s', uri) + try: + self._connection = setConnection(uri, DB_TABLES) + except AssertionError as e: +@@ -593,7 +592,7 @@ class IMDbSqlAccessSystem(IMDbBase): + # Maps some IDs to the corresponding strings. + self._kind = {} + self._kindRev = {} +- self._sql_logger.debug('reading constants from the database') ++ logger.debug('reading constants from the database') + try: + for kt in KindType.select(): + self._kind[kt.id] = kt.kind +@@ -1616,7 +1615,7 @@ class IMDbSqlAccessSystem(IMDbBase): + return + if not hasattr(self, '_connection'): + return +- self._sql_logger.debug('closing connection to the database') ++ logger.debug('closing connection to the database') + try: + self._connection.close() + except: diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index ec386fb1e11..72b60ba902c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2874,6 +2874,8 @@ in { else callPackage ../development/python-modules/imbalanced-learn { }; + imdbpy = callPackage ../development/python-modules/imdbpy { }; + img2pdf = callPackage ../development/python-modules/img2pdf { }; imgaug = callPackage ../development/python-modules/imgaug { };