ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject [incubator-ponymail] branch master updated: copy wanted_pkgs to avoid iterating over a "moving target".
Date Sat, 27 Apr 2019 00:14:41 GMT
This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail.git


The following commit(s) were added to refs/heads/master by this push:
     new cc01130  copy wanted_pkgs to avoid iterating over a "moving target".
cc01130 is described below

commit cc01130d68220afe186958c93c94c1a6456ec468
Author: Daniel Gruno <humbedooh@apache.org>
AuthorDate: Fri Apr 26 19:14:21 2019 -0500

    copy wanted_pkgs to avoid iterating over a "moving target".
    
    This addresses #490
---
 tools/setup.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tools/setup.py b/tools/setup.py
index 3110fa7..4c9ec87 100755
--- a/tools/setup.py
+++ b/tools/setup.py
@@ -31,22 +31,24 @@ wanted_pkgs = [
     'elasticsearch',# used by setup.py, archiver.py and elastic.py
     'formatflowed', # used by archiver.py
     'netaddr',      # used by archiver.py
-    'certifi'       # used by archiver.py and elastic.py
+    'certifi',       # used by archiver.py and elastic.py
     ]
 
+missing_pkgs = list(wanted_pkgs) # copy to avoid corruption
 for pkg in wanted_pkgs:
     if importlib.util.find_spec(pkg):
-        wanted_pkgs.remove(pkg)
+        missing_pkgs.remove(pkg)
 
-if wanted_pkgs:
+if missing_pkgs:
     print("It looks like you need to install some python modules first")
     print("The following packages are required: ")
-    for pkg in wanted_pkgs:
+    for pkg in missing_pkgs:
         print(" - %s" % pkg)
     print("You may use your package manager, or run the following command:")
-    print("pip3 install %s" % " ".join(wanted_pkgs))
+    print("pip3 install %s" % " ".join(missing_pkgs))
     sys.exit(-1)
 
+
 # at this point we can assume elasticsearch is present
 from elasticsearch import Elasticsearch
 from elasticsearch import ElasticsearchException


Mime
View raw message