|
16 | 16 | from __future__ import with_statement |
17 | 17 |
|
18 | 18 | from ConfigParser import ConfigParser |
19 | | -import os |
20 | | -import sys |
21 | 19 |
|
22 | 20 | from distribute_setup import use_setuptools |
23 | 21 | use_setuptools() |
24 | 22 | from setuptools import Command, setup |
25 | | -from setuptools.command.sdist import sdist as _sdist |
26 | 23 |
|
27 | 24 | class constants(Command): |
28 | 25 |
|
@@ -56,54 +53,47 @@ def run(self): |
56 | 53 | d = "{'value': %s, 'precision': %s, 'units': '%s'}"%(val, prec, unit) |
57 | 54 | f.write("physical_constants['%s'] = %s\n"%(name, d)) |
58 | 55 |
|
59 | | -class sdist(_sdist): |
60 | | - |
61 | | - def run(self): |
62 | | - with open('quantities/version.py') as f: |
63 | | - for line in f: |
64 | | - if line.startswith('__version__'): |
65 | | - exec(line) |
66 | | - cfg = ConfigParser() |
67 | | - cfg.read('setup.cfg') |
68 | | - if __version__ != cfg.get('metadata', 'version'): |
69 | | - with open('setup.cfg') as f: |
70 | | - lines = f.readlines() |
71 | | - with open('setup.cfg', 'w') as f: |
72 | | - for line in lines: |
73 | | - if line.startswith('version'): |
74 | | - line = 'version = %s\n' % __version__ |
75 | | - f.write(line) |
76 | | - _sdist.run(self) |
77 | 56 |
|
78 | 57 | cfg = ConfigParser() |
79 | 58 | cfg.read('setup.cfg') |
80 | 59 |
|
| 60 | +with open('quantities/version.py') as f: |
| 61 | + for line in f: |
| 62 | + if line.startswith('__version__'): |
| 63 | + exec(line) |
| 64 | +if __version__ != cfg.get('metadata', 'version'): |
| 65 | + with open('setup.cfg') as f: |
| 66 | + lines = f.readlines() |
| 67 | + with open('setup.cfg', 'w') as f: |
| 68 | + for line in lines: |
| 69 | + if line.startswith('version'): |
| 70 | + line = 'version = %s\n' % __version__ |
| 71 | + f.write(line) |
| 72 | + |
81 | 73 | setup( |
82 | 74 | author = cfg.get('metadata', 'author'), |
83 | 75 | author_email = cfg.get('metadata', 'author_email'), |
84 | 76 | classifiers = cfg.get('metadata', 'classifiers').split('\n'), |
85 | 77 | cmdclass = { |
86 | 78 | 'constants' : constants, |
87 | | - 'sdist' : sdist, |
88 | 79 | }, |
89 | 80 | description = cfg.get('metadata', 'description'), |
90 | 81 | download_url = cfg.get('metadata', 'download_url'), |
91 | 82 | keywords = ['quantities', 'physical quantities', 'units'], |
92 | 83 | license = 'BSD', |
93 | 84 | long_description = cfg.get('metadata', 'long_description'), |
94 | 85 | name = "quantities", |
95 | | - package_data = { |
96 | | - 'quantities':['tests/*', 'constants/NIST_codata.txt'] |
97 | | - }, |
98 | 86 | packages = [ |
99 | 87 | 'quantities', |
100 | | - 'quantities.units', |
101 | 88 | 'quantities.constants', |
102 | | - 'quantities.umath' |
| 89 | + 'quantities.tests', |
| 90 | + 'quantities.umath', |
| 91 | + 'quantities.units', |
103 | 92 | ], |
104 | 93 | platforms = cfg.get('metadata', 'platforms'), |
105 | 94 | requires = cfg.get('metadata', 'requires').split('\n'), |
106 | 95 | test_suite = 'nose.collector', |
107 | 96 | url = cfg.get('metadata', 'url'), |
108 | 97 | version = cfg.get('metadata', 'version'), |
| 98 | + zip_safe = cfg.getboolean('metadata', 'zip_safe'), |
109 | 99 | ) |
0 commit comments