Hi,

currently if I make a typo in uWSGI buildconf ini file and add nonexisting 
plugin name, I will get very wierd error:

Embedded plugin:

[gcc -pthread] plugins/zergpool/zergpool.o
[gcc -pthread] plugins/redislog/redislog_plugin.o
Traceback (most recent call last):
  File "uwsgiconfig.py", line 983, in <module>
    build_uwsgi(uConf(bconf))
  File "uwsgiconfig.py", line 203, in build_uwsgi
    path + '/' + cfile + '.o', path + '/' + cfile + '.c')
  File "uwsgiconfig.py", line 95, in compile
    source_stat = os.stat(srcfile)
OSError: [Errno 2] No such file or directory: 
'plugins/cheaper_busynessx/redislog_plugin.c'

Loadable plugin:

detected include path: ['/usr/local/include', '/usr/lib/gcc/x86_64-linux-
gnu/4.4.3/include', '/usr/lib/gcc/x86_64-linux-gnu/4.4.3/include-fixed', 
'/usr/include']
*** uWSGI building and linking plugin plugins/cgix ***
Traceback (most recent call last):
  File "uwsgiconfig.py", line 1019, in <module>
    build_plugin(sys.argv[2], uc, cflags, ldflags, libs, name)
  File "uwsgiconfig.py", line 887, in build_plugin
    import uwsgiplugin as up
ImportError: No module named uwsgiplugin


It doesn't tell us what is wrong right away, after patch:

Embedded plugin:

* Compiling redislog plugin:
plugins/redislog/redislog_plugin.o is up to date
* Compiling cheaper_busynessx plugin:
Error! Plugin 'cheaper_busynessx' not found

Loadable plugin:

detected include path: ['/usr/local/include', '/usr/lib/gcc/x86_64-linux-
gnu/4.4.3/include', '/usr/lib/gcc/x86_64-linux-gnu/4.4.3/include-fixed', 
'/usr/include']
*** uWSGI building and linking plugin plugins/cgix ***
Error! 'plugins/cgix' not found

Łukasz Mierzwa
--- uwsgiconfig.py.orig	2012-07-08 06:08:35.000000000 +0200
+++ uwsgiconfig.py	2012-08-09 14:34:36.278188638 +0200
@@ -170,6 +170,11 @@
                 path = 'plugins/%s' % p
                 path = path.rstrip('/')
 
+                print("* Compiling %s plugin:" % p)
+                if not os.path.exists(path):
+                    print("Error! Plugin '%s' not found" % p)
+                    sys.exit(1)
+
                 sys.path.insert(0, path)
                 import uwsgiplugin as up
                 reload(up)
@@ -878,6 +883,10 @@
 def build_plugin(path, uc, cflags, ldflags, libs, name = None):
     path = path.rstrip('/')
 
+    if not os.path.exists(path):
+        print("Error! '%s' does not exists" % path)
+        sys.exit(1)
+
     sys.path.insert(0, path)
     import uwsgiplugin as up
     reload(up)
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to