FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-quantities/setup.py at master · ddale/python-quantities · GitHub
ddale
/
python-quantities
Public
forked from
python-quantities/python-quantities
Notifications
You must be signed in to change notification settings
Fork
0
Star
4
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
python-quantities
/
setup.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
140 lines (112 loc) · 4.29 KB
Breadcrumbs
python-quantities
/
setup.py
Copy path
File metadata and controls
executable file
·
140 lines (112 loc) · 4.29 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
from
distutils
.
cmd
import
Command
from
distutils
.
core
import
setup
from
distutils
.
command
.
sdist
import
sdist
as
_sdist
from
distutils
.
command
.
build
import
build
as
_build
import
os
class
data
(
Command
):
description
=
"Convert the NIST databas of constants"
user_options
=
[]
boolean_options
=
[]
def
initialize_options
(
self
):
pass
def
finalize_options
(
self
):
pass
def
run
(
self
):
with
open
(
'quantities/constants/NIST_codata.txt'
)
as
f
:
data
=
f
.
read
()
data
=
data
.
split
(
'
\n
'
)[
10
:
-
1
]
with
open
(
'quantities/constants/_codata.py'
,
'w'
)
as
f
:
f
.
write
(
'# THIS FILE IS AUTOMATICALLY GENERATED
\n
'
)
f
.
write
(
'# ANY CHANGES MADE HERE WILL BE LOST
\n
\n
'
)
f
.
write
(
'physical_constants = {}
\n
\n
'
)
for
line
in
data
:
name
=
line
[:
55
].
rstrip
().
replace
(
'mag.'
,
'magnetic'
)
name
=
name
.
replace
(
'mom.'
,
'moment'
)
val
=
line
[
55
:
77
].
replace
(
' '
,
''
).
replace
(
'...'
,
''
)
prec
=
line
[
77
:
99
].
replace
(
' '
,
''
).
replace
(
'(exact)'
,
'0'
)
unit
=
line
[
99
:].
rstrip
().
replace
(
' '
,
'*'
).
replace
(
'^'
,
'**'
)
d
=
"{'value': %s, 'precision': %s, 'units': '%s'}"
\
%
(
val
,
prec
,
unit
)
f
.
write
(
"physical_constants['%s'] = %s
\n
"
%
(
name
,
d
))
class
sdist
(
_sdist
):
def
run
(
self
):
self
.
run_command
(
'data'
)
_sdist
.
run
(
self
)
class
build
(
_build
):
def
run
(
self
):
self
.
run_command
(
'data'
)
_build
.
run
(
self
)
class
test
(
Command
):
"""Run the test suite."""
description
=
"Run the test suite"
user_options
=
[(
'verbosity='
,
'V'
,
'set test report verbosity'
)]
def
initialize_options
(
self
):
self
.
verbosity
=
0
def
finalize_options
(
self
):
try
:
self
.
verbosity
=
int
(
self
.
verbosity
)
except
ValueError
:
raise
ValueError
(
'verbosity must be an integer.'
)
def
run
(
self
):
import
sys
if
sys
.
version
.
startswith
(
'2.6'
)
or
sys
.
version
.
startswith
(
'3.1'
):
import
unittest2
as
unittest
else
:
import
unittest
suite
=
unittest
.
TestLoader
().
discover
(
'.'
)
unittest
.
TextTestRunner
(
verbosity
=
self
.
verbosity
+
1
).
run
(
suite
)
packages
=
[]
for
dirpath
,
dirnames
,
filenames
in
os
.
walk
(
'quantities'
):
if
'__init__.py'
in
filenames
:
packages
.
append
(
'.'
.
join
(
dirpath
.
split
(
os
.
sep
)))
else
:
del
(
dirnames
[:])
with
open
(
'quantities/version.py'
)
as
f
:
for
line
in
f
:
if
line
.
startswith
(
'__version__'
):
exec
(
line
)
setup
(
author
=
'Darren Dale'
,
author_email
=
'dsdale24@gmail.com'
,
classifiers
=
"""Development Status :: 4 - Beta
Environment :: Console
Intended Audience :: Developers
Intended Audience :: Education
Intended Audience :: End Users/Desktop
Intended Audience :: Science/Research
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Python
Topic :: Education
Topic :: Scientific/Engineering
"""
,
cmdclass
=
{
'build'
:
build
,
'data'
:
data
,
'sdist'
:
sdist
,
'test'
:
test
,
},
description
=
"Support for physical quantities with units, based on numpy"
,
download_url
=
"http://pypi.python.org/pypi/quantities"
,
keywords
=
[
'quantities'
,
'units'
,
'physical'
,
'constants'
],
license
=
'BSD'
,
long_description
=
"""Quantities is designed to handle arithmetic and
conversions of physical quantities, which have a magnitude, dimensionality
specified by various units, and possibly an uncertainty. See the tutorial_
for examples. Quantities builds on the popular numpy library and is
designed to work with numpy ufuncs, many of which are already
supported. Quantities is actively developed, and while the current features
and API are stable, test coverage is incomplete so the package is not
suggested for mission-critical applications.
.. _tutorial: http://packages.python.org/quantities/user/tutorial.html
"""
,
name
=
'quantities'
,
packages
=
packages
,
platforms
=
'Any'
,
requires
=
[
'python (>=2.6.0)'
,
'numpy (>=1.4.0)'
,
],
url
=
'http://packages.python.org/quantities'
,
version
=
__version__
,
)
Back
|
FazBrowse Home
|
New Git URL