diff options
| author | Federico Di Gregorio <fog@initd.org> | 2005-11-03 01:35:17 +0000 |
|---|---|---|
| committer | Federico Di Gregorio <fog@initd.org> | 2005-11-03 01:35:17 +0000 |
| commit | f03b94d84b93ef154bed3d8064b56fef9e0ead12 (patch) | |
| tree | ea56e3412f09c59f8624064b2c29cae572c72a33 /setup.py | |
| parent | d67b171eede2c1749f28db93c9663badd399480e (diff) | |
| download | psycopg2-f03b94d84b93ef154bed3d8064b56fef9e0ead12.tar.gz | |
Run-time check for Decimal on Python 2.3.
Diffstat (limited to 'setup.py')
| -rw-r--r-- | setup.py | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -81,11 +81,13 @@ class psycopg_build_ext(build_ext): ('use-pg-dll', None, "Build against libpq.dll"), ('use-pydatetime', None, - "Use Python datatime objects for date and time representation.") + "Use Python datatime objects for date and time representation."), + ('use-decimal', None, + "Use Decimal type even on Python 2.3 if the module is provided."), ]) boolean_options = build_ext.boolean_options[:] - boolean_options.extend(('use-pg-dll', 'use-pydatetime')) + boolean_options.extend(('use-pg-dll', 'use-pydatetime', 'use-decimal')) # libpq directory in win32 source distribution: compiler dependant. libpqdir = None @@ -246,9 +248,7 @@ define_macros.append(('PY_MINOR_VERSION', str(sys.version_info[1]))) # some macros related to python versions and features if sys.version_info[0] >= 2 and sys.version_info[1] >= 3: define_macros.append(('HAVE_PYBOOL','1')) -if sys.version_info[0] >= 2 and sys.version_info[1] >= 4: - define_macros.append(('HAVE_DECIMAL','1')) - + # gather information to build the extension module ext = [] ; data_files = [] @@ -265,6 +265,13 @@ from ConfigParser import ConfigParser parser = ConfigParser() parser.read('setup.cfg') +# Choose if to use Decimal type +use_decimal = int(parser.get('build_ext', 'use_decimal')) +if sys.version_info[0] >= 2 and ( + sys.version_info[1] >= 4 or (sys.version_info[1] == 3 and use_decimal)): + define_macros.append(('HAVE_DECIMAL','1')) + version_flags.append('dec') + # Choose a datetime module have_pydatetime = False have_mxdatetime = False |
