Skip to content
Browse files

fixed pyodbc.version for non-beta releases

  • Loading branch information...
1 parent 1567234 commit c8c8fe1ae3ecd69fd3d6ea5b680a60b87ed3e316 Michael Kleehammer committed Nov 26, 2008
Showing with 9 additions and 7 deletions.
  1. +2 −3 setup.py
  2. +7 −4 src/pyodbcmodule.cpp
View
5 setup.py
@@ -6,7 +6,6 @@
from distutils.errors import *
from os.path import exists, abspath, dirname, join, isdir
-
OFFICIAL_BUILD = 9999
def main():
@@ -118,8 +117,8 @@ def get_version():
# beta for 2.1.5. Using 'git describe' we can find out how many changes have been made after 2.1.4 and we'll use
# this count as the beta id (beta1, beta2, etc.)
#
- # Since the 4 numbers are put into the Windows DLL, we want to make sure the beta versions sort *after* the
- # official, so we set the final build number to 9999, but we don't show it.
+ # Since the 4 numbers are put into the Windows DLL, we want to make sure the beta versions sort *before* the
+ # official, so we set the official build number to 9999, but we don't show it.
name = None # branch/feature name. Should be None for official builds.
numbers = None # The 4 integers that make up the version.
View
11 src/pyodbcmodule.cpp
@@ -753,13 +753,16 @@ initpyodbc()
if (!CreateExceptions())
return;
+ // The 'build' version number is a beta identifier. For example, if it is 7, then we are on beta7 of the
+ // (major,minor.micro) version. On Windows, we poke these values into the DLL's version resource, so when we make
+ // an official build (which come *after* the betas), we set the BUILD to 9999 so installers will know that it
+ // should replace any installed betas. However, we obviously don't want to see these.
+
PyObject* pVersion;
- if (PYODBC_BUILD == 0)
+ if (PYODBC_BUILD == 9999)
pVersion = PyString_FromFormat("%d.%d.%d", PYODBC_MAJOR, PYODBC_MINOR, PYODBC_MICRO);
else
- pVersion = PyString_FromFormat("%d.%d.%d-%d", PYODBC_MAJOR, PYODBC_MINOR, PYODBC_MICRO, PYODBC_BUILD);
- if (!pVersion)
- return;
+ pVersion = PyString_FromFormat("%d.%d.%d-beta%d", PYODBC_MAJOR, PYODBC_MINOR, PYODBC_MICRO, PYODBC_BUILD);
PyModule_AddObject(pModule, "version", pVersion);
PyModule_AddIntConstant(pModule, "threadsafety", 1);

0 comments on commit c8c8fe1

Please sign in to comment.
Something went wrong with that request. Please try again.