| 
									
										
										
										
											2001-12-04 01:11:32 +00:00
										 |  |  | #include "Python.h"
 | 
					
						
							| 
									
										
										
										
											1997-05-20 22:40:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											1999-08-27 20:39:37 +00:00
										 |  |  | #ifndef DONT_HAVE_STDIO_H
 | 
					
						
							| 
									
										
										
										
											1997-01-20 18:34:26 +00:00
										 |  |  | #include <stdio.h>
 | 
					
						
							| 
									
										
										
										
											1999-08-27 20:39:37 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											1997-01-20 18:34:26 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifndef DATE
 | 
					
						
							|  |  |  | #ifdef __DATE__
 | 
					
						
							|  |  |  | #define DATE __DATE__
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define DATE "xx/xx/xx"
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef TIME
 | 
					
						
							|  |  |  | #ifdef __TIME__
 | 
					
						
							|  |  |  | #define TIME __TIME__
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define TIME "xx:xx:xx"
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-05 20:51:24 +01:00
										 |  |  | /* XXX Only unix build process has been tested */ | 
					
						
							| 
									
										
										
										
											2017-03-04 00:19:55 -05:00
										 |  |  | #ifndef GITVERSION
 | 
					
						
							|  |  |  | #define GITVERSION ""
 | 
					
						
							| 
									
										
										
										
											2011-03-05 20:51:24 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2017-03-04 00:19:55 -05:00
										 |  |  | #ifndef GITTAG
 | 
					
						
							|  |  |  | #define GITTAG ""
 | 
					
						
							| 
									
										
										
										
											2011-03-05 20:51:24 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2017-03-04 00:19:55 -05:00
										 |  |  | #ifndef GITBRANCH
 | 
					
						
							|  |  |  | #define GITBRANCH ""
 | 
					
						
							| 
									
										
										
										
											2011-03-05 20:51:24 +01:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-12-18 01:27:35 +00:00
										 |  |  | const char * | 
					
						
							| 
									
										
										
										
											2005-12-18 22:46:35 +00:00
										 |  |  | Py_GetBuildInfo(void) | 
					
						
							| 
									
										
										
										
											2005-12-18 01:27:35 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-03-04 00:19:55 -05:00
										 |  |  |     static char buildinfo[50 + sizeof(GITVERSION) + | 
					
						
							|  |  |  |                           ((sizeof(GITTAG) > sizeof(GITBRANCH)) ? | 
					
						
							|  |  |  |                            sizeof(GITTAG) : sizeof(GITBRANCH))]; | 
					
						
							|  |  |  |     const char *revision = _Py_gitversion(); | 
					
						
							| 
									
										
										
										
											2010-05-09 16:14:21 +00:00
										 |  |  |     const char *sep = *revision ? ":" : ""; | 
					
						
							| 
									
										
										
										
											2017-03-04 00:19:55 -05:00
										 |  |  |     const char *gitid = _Py_gitidentifier(); | 
					
						
							|  |  |  |     if (!(*gitid)) | 
					
						
							|  |  |  |         gitid = "default"; | 
					
						
							| 
									
										
										
										
											2010-05-09 16:14:21 +00:00
										 |  |  |     PyOS_snprintf(buildinfo, sizeof(buildinfo), | 
					
						
							| 
									
										
										
										
											2017-03-04 00:19:55 -05:00
										 |  |  |                   "%s%s%s, %.20s, %.9s", gitid, sep, revision, | 
					
						
							| 
									
										
										
										
											2010-05-09 16:14:21 +00:00
										 |  |  |                   DATE, TIME); | 
					
						
							|  |  |  |     return buildinfo; | 
					
						
							| 
									
										
										
										
											2005-12-18 01:27:35 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2005-12-19 14:43:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-05 20:51:24 +01:00
										 |  |  | const char * | 
					
						
							| 
									
										
										
										
											2017-03-04 00:19:55 -05:00
										 |  |  | _Py_gitversion(void) | 
					
						
							| 
									
										
										
										
											2011-03-05 20:51:24 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-03-04 00:19:55 -05:00
										 |  |  |     return GITVERSION; | 
					
						
							| 
									
										
										
										
											2011-03-05 20:51:24 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const char * | 
					
						
							| 
									
										
										
										
											2017-03-04 00:19:55 -05:00
										 |  |  | _Py_gitidentifier(void) | 
					
						
							| 
									
										
										
										
											2011-03-05 20:51:24 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-03-04 00:19:55 -05:00
										 |  |  |     const char *gittag, *gitid; | 
					
						
							|  |  |  |     gittag = GITTAG; | 
					
						
							|  |  |  |     if ((*gittag) && strcmp(gittag, "undefined") != 0) | 
					
						
							|  |  |  |         gitid = gittag; | 
					
						
							| 
									
										
										
										
											2011-03-05 20:51:24 +01:00
										 |  |  |     else | 
					
						
							| 
									
										
										
										
											2017-03-04 00:19:55 -05:00
										 |  |  |         gitid = GITBRANCH; | 
					
						
							|  |  |  |     return gitid; | 
					
						
							| 
									
										
										
										
											2011-03-05 20:51:24 +01:00
										 |  |  | } |