|
| 1 | +#!/usr/bin/env python |
| 2 | + |
| 3 | +#+ |
| 4 | +# |
| 5 | +# This file is part of quantities, a python package for handling physical |
| 6 | +# quantities based on numpy. |
| 7 | +# |
| 8 | +# Copyright (C) 2009 Darren Dale |
| 9 | +# http://packages.python.org/quantities |
| 10 | +# License: BSD (See doc/users/license.rst for full license) |
| 11 | +# |
| 12 | +# $Date$ |
| 13 | +# |
| 14 | +#- |
| 15 | + |
| 16 | +""" |
| 17 | + setup script for the quantities package |
| 18 | +
|
| 19 | + options: |
| 20 | +
|
| 21 | + * Unicode |
| 22 | +
|
| 23 | + Units are presented using unicode by default, but this can be problematic |
| 24 | + on some platforms like windows. Unicode can be disabled, and units |
| 25 | + presented as simple ASCII text by passing the "--no-unicode" flag to the |
| 26 | + setup script:: |
| 27 | +
|
| 28 | + python setup.py build --no-unicode |
| 29 | +""" |
| 30 | + |
1 | 31 | from __future__ import with_statement |
2 | 32 |
|
| 33 | +import sys |
| 34 | + |
3 | 35 | try: |
4 | 36 | from setuptools import setup |
5 | 37 | except ImportError: |
|
22 | 54 | d = "{'value': %s, 'precision': %s, 'units': '%s'}"%(val, prec, unit) |
23 | 55 | f.write("physical_constants['%s'] = %s\n"%(name, d)) |
24 | 56 |
|
| 57 | +USE_UNICODE = True |
| 58 | +for arg in sys.argv[:]: |
| 59 | + if arg.find('--no-unicode') == 0: |
| 60 | + USE_UNICODE = False |
| 61 | + sys.argv.remove(arg) |
| 62 | +with file('quantities/config.py', 'w') as f: |
| 63 | + |
| 64 | + f.write('# THIS FILE IS AUTOMATICALLY GENERATED AT BUILD TIME\n') |
| 65 | + f.write('# ANY CHANGES MADE HERE WILL BE LOST\n') |
| 66 | + f.write('# PASS --no-unicode FLAG TO setup.py TO DISABLE UNICODE\n\n') |
| 67 | + f.write('USE_UNICODE = %s'% USE_UNICODE) |
| 68 | + |
25 | 69 | desc = 'Support for physical quantities based on the popular numpy library' |
26 | 70 | long_desc = "Quantities is designed to handle arithmetic and conversions of \ |
27 | 71 | physical quantities, which have a magnitude, dimensionality specified by \ |
|
0 commit comments