Skip to content

Commit

Permalink
Make request interruptable (using map_async)
Browse files Browse the repository at this point in the history
  • Loading branch information
fedosov committed Sep 3, 2013
1 parent e716da0 commit b38f57b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions updates.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Mikhail Fedosov ([email protected])"
__version__ = "0.1.3.5"
__version__ = "0.1.3.6"

# http://code.activestate.com/recipes/577708-check-for-package-updates-on-pypi-works-best-in-pi/
# http://stackoverflow.com/questions/287871/print-in-terminal-with-colors-using-python
Expand Down Expand Up @@ -89,13 +89,12 @@ def main():
map(check_package, pip.get_installed_distributions())
else:
pypi_pool = Pool()
pypi_pool_map = pypi_pool.map_async(check_package, pip.get_installed_distributions())
try:
pypi_pool.map(check_package, pip.get_installed_distributions())
pypi_pool.close()
pypi_pool.join()
pypi_pool_map.get(0xFFFF)
except KeyboardInterrupt:
print("Aborted")
pypi_pool.terminate()
return

if __name__ == "__main__":
main()

0 comments on commit b38f57b

Please sign in to comment.