Browse Source

Add python version with -v option

Yann Weber 5 years ago
parent
commit
c83d63c8f2
3 changed files with 11 additions and 2 deletions
  1. 2
    0
      include/pyutils.h
  2. 3
    2
      src/conf.c
  3. 6
    0
      src/pyutils.c

+ 2
- 0
include/pyutils.h View File

@@ -44,5 +44,7 @@ PyObject* import_entrypoint();
44 44
 
45 45
 void log_expt(int priority);
46 46
 
47
+void pyfcgi_python_version(char[16]);
48
+
47 49
 #endif
48 50
 

+ 3
- 2
src/conf.c View File

@@ -32,8 +32,9 @@ void usage()
32 32
 
33 33
 void print_version(int fd)
34 34
 {
35
-	dprintf(fd, "%s\n", PACKAGE_STRING);
36
-	/**@todo TODO : get python version */
35
+	char version[16];
36
+	pyfcgi_python_version(version);
37
+	dprintf(fd, "%s\nPython %s\n", PACKAGE_STRING, version);
37 38
 }
38 39
 
39 40
 void default_conf()

+ 6
- 0
src/pyutils.c View File

@@ -196,3 +196,9 @@ void log_expt(int priority)
196 196
 	pyfcgi_log(priority, msg);
197 197
 }
198 198
 
199
+void pyfcgi_python_version(char version[16])
200
+{
201
+	snprintf(version, 16, "%d.%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION,
202
+		PY_MICRO_VERSION);
203
+}
204
+

Loading…
Cancel
Save