Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python-telegram-bot: init at 9.0.0 #34015

Merged
merged 2 commits into from Feb 10, 2018
Merged

python-telegram-bot: init at 9.0.0 #34015

merged 2 commits into from Feb 10, 2018

Conversation

veprbl
Copy link
Member

@veprbl veprbl commented Jan 18, 2018

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@veprbl veprbl requested a review from FRidh as a code owner January 18, 2018 16:25
@veprbl
Copy link
Member Author

veprbl commented Jan 18, 2018

@GrahamcOfBorg build python2Packages.python-telegram-bot python3Packages.python-telegram-bot

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success for system: x86_64-linux

running build_ext
patching script interpreter paths in /nix/store/lql5d2803ayadha33fp0j117g0r6lhmq-python3.6-python-telegram-bot-9.0.0
checking for references to /tmp/nix-build-python3.6-python-telegram-bot-9.0.0.drv-0 in /nix/store/lql5d2803ayadha33fp0j117g0r6lhmq-python3.6-python-telegram-bot-9.0.0...

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/pkp39m33rkyg6g5kvkdgnyqaf33kkx5f-python2.7-python-telegram-bot-9.0.0
/nix/store/lql5d2803ayadha33fp0j117g0r6lhmq-python3.6-python-telegram-bot-9.0.0

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success for system: x86_64-darwin

Requirement already satisfied: certifi in /nix/store/lp8mqzwf7fiybh0rj3wfs2k06h9m4nni-python3.6-certifi-2017.7.27.1/lib/python3.6/site-packages (from python-telegram-bot==9.0.0)
Installing collected packages: python-telegram-bot
Successfully installed python-telegram-bot-9.0.0
/private/tmp/nix-build-python3.6-python-telegram-bot-9.0.0.drv-0/python-telegram-bot-9.0.0
post-installation fixup
strip is /nix/store/i1zz228nl3bljcbb83fq0rq7lr7nvv4y-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/sbay1c3bm5zp27myrfndybhazh48m28a-python3.6-python-telegram-bot-9.0.0/lib
patching script interpreter paths in /nix/store/sbay1c3bm5zp27myrfndybhazh48m28a-python3.6-python-telegram-bot-9.0.0
/nix/store/64h993iq1lkndhq9035wli6fn1y8msmy-python2.7-python-telegram-bot-9.0.0
/nix/store/sbay1c3bm5zp27myrfndybhazh48m28a-python3.6-python-telegram-bot-9.0.0

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Success for system: aarch64-linux

reading manifest template 'MANIFEST.in'
writing manifest file 'python_telegram_bot.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/nfhc259dz9vxpw7f420bnv4mnmbcrpw1-python2.7-python-telegram-bot-9.0.0
/nix/store/jnq986i26ghw34vbzril6pcfnv9j8hmr-python3.6-python-telegram-bot-9.0.0

buildPythonPackage rec {
pname = "python-telegram-bot";
version = "9.0.0";
name = "${pname}-${version}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for name. Will be derived from pname and version.

sha256 = "0a5b4wfc6ms7kblynw2h3ygpww98kyz5n8iibqbdyykwx8xj7hzm";
};

propagatedBuildInputs = [ certifi future ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the extras_requires ujson and pysocks?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If one wants those they can just add those packages to the closure in a Python env.

};

propagatedBuildInputs = [ certifi future ];
doCheck = !isPy3k;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for this? Can you include a comment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is that 0 tests are run when using Python 2, so it should really be just doCheck = false for both.
But I made one test run by adding pysocks as a dependency. I believe this is possible for the 7 remaining failing tests as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out the tests need network access (obviously). So it should be doCheck = false.

@dotlambda
Copy link
Member

The package uses a vendored version of urllib3. Just as ArchLinux does, I propose the following change:

diff --git a/pkgs/development/python-modules/python-telegram-bot/default.nix b/pkgs/development/python-modules/python-telegram-bot/default.nix
index b753e8db70f..d5ce74ff942 100644
--- a/pkgs/development/python-modules/python-telegram-bot/default.nix
+++ b/pkgs/development/python-modules/python-telegram-bot/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchPypi, buildPythonPackage, isPy3k, certifi, future }:
+{ stdenv, fetchPypi, buildPythonPackage, certifi, future, urllib3 }:
 
 buildPythonPackage rec {
   pname = "python-telegram-bot";
@@ -10,8 +10,16 @@ buildPythonPackage rec {
     sha256 = "0a5b4wfc6ms7kblynw2h3ygpww98kyz5n8iibqbdyykwx8xj7hzm";
   };
 
-  propagatedBuildInputs = [ certifi future ];
-  doCheck = !isPy3k;
+  prePatch = ''
+    rm -rf telegram/vendor
+    substituteInPlace telegram/utils/request.py \
+      --replace "import telegram.vendor.ptb_urllib3.urllib3 as urllib3" "import urllib3 as urllib3" \
+      --replace "import telegram.vendor.ptb_urllib3.urllib3.contrib.appengine as appengine" "import urllib3.contrib.appengine as appengine" \
+      --replace "from telegram.vendor.ptb_urllib3.urllib3.connection import HTTPConnection" "from urllib3.connection import HTTPConnection" \
+      --replace "from telegram.vendor.ptb_urllib3.urllib3.util.timeout import Timeout" "from urllib3.util.timeout import Timeout"
+  '';
+
+  propagatedBuildInputs = [ certifi future urllib3 ];
 
   meta = with stdenv.lib; {
     description = "This library provides a pure Python interface for the Telegram Bot API.";

@Mic92 Mic92 merged commit e2d2503 into NixOS:master Feb 10, 2018
@veprbl veprbl deleted the pytgbot branch April 15, 2018 22:35
@veprbl veprbl restored the pytgbot branch December 1, 2020 16:52
@veprbl veprbl deleted the pytgbot branch December 1, 2020 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants