You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2019/04/27 00:14:41 UTC

[incubator-ponymail] branch master updated: copy wanted_pkgs to avoid iterating over a "moving target".

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 <hu...@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