[Python-modules-commits] r3979 - in tools (find_python_dependencies.sh)

piotr at users.alioth.debian.org piotr at users.alioth.debian.org
Mon Dec 17 20:32:24 UTC 2007


    Date: Monday, December 17, 2007 @ 20:32:24
  Author: piotr
Revision: 3979

detect comments lines correctly ('import foo # comment' issue)

Modified:
  tools/find_python_dependencies.sh

Modified: tools/find_python_dependencies.sh
===================================================================
--- tools/find_python_dependencies.sh	2007-12-17 17:08:58 UTC (rev 3978)
+++ tools/find_python_dependencies.sh	2007-12-17 20:32:24 UTC (rev 3979)
@@ -39,10 +39,10 @@
 fi
 
 # omit "from .* import .*" for now:
-MODULES1=`grep -v \# -r $1 | sed -rne "s,.*:\s*import\s+($REGEXPR).*,\1,p" | sort -u`
+MODULES1=`grep -v '^\s*#' -r $1 | sed -rne "s,.*:\s*import\s+($REGEXPR).*,\1,p" | sort -u`
 
 # "from .* import .*"
-MODULES2=`grep -v \# -r $1 | sed -rne "s,.*from\s+($REGEXPR)\s+import.*,\1,p" | sort -u`
+MODULES2=`grep -v '^\s*#' -r $1 | sed -rne "s,.*from\s+($REGEXPR)\s+import.*,\1,p" | sort -u`
 MODULES=`echo "$MODULES1"; echo "$MODULES2" | sort -u`
 
 # example __file__ output: (remember while grepping)




More information about the Python-modules-commits mailing list