Skip to content

Commit bd79b12

Browse files
committed
Working on alternative setup
1 parent a014c89 commit bd79b12

File tree

3 files changed

+123
-3
lines changed

3 files changed

+123
-3
lines changed

MANIFEST

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
LICENSE.txt
33
README
44
setup.cfg
5-
setup.py
5+
setup2.py
66
weewx.conf
77
bin/daemon.py
88
bin/wee_config_database
@@ -26,7 +26,6 @@ bin/weeplot/utilities.py
2626
bin/weeutil/Moon.py
2727
bin/weeutil/Sun.py
2828
bin/weeutil/__init__.py
29-
bin/weeutil/config.py
3029
bin/weeutil/ftpupload.py
3130
bin/weeutil/rsyncupload.py
3231
bin/weeutil/weeutil.py
@@ -77,6 +76,7 @@ docs/css/jquery.tocify.css
7776
docs/css/weewx_docs.css
7877
docs/css/ui-lightness/jquery-ui-1.10.4.custom.css
7978
docs/css/ui-lightness/jquery-ui-1.10.4.custom.min.css
79+
docs/css/ui-lightness/images/animated-overlay.gif
8080
docs/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png
8181
docs/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png
8282
docs/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png
@@ -99,6 +99,7 @@ docs/images/daywindvec.png
9999
docs/images/ferrites.jpg
100100
docs/images/funky_degree.png
101101
docs/images/image_parts.png
102+
docs/images/image_parts.xcf
102103
docs/images/logo-apple.png
103104
docs/images/logo-centos.png
104105
docs/images/logo-debian.png

MANIFEST.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
recursive-include docs *.css *.htm *.js *.png *.jpg *.txt
1+
recursive-include docs *
22
recursive-include util *
33
recursive-include skins *
44
recursive-include extensions *

setup2.py

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
import os.path
2+
import sys
3+
4+
from distutils.core import setup
5+
from distutils.command.install_data import install_data
6+
from distutils.command.install_lib import install_lib
7+
from distutils.command.install_scripts import install_scripts
8+
from distutils.command.sdist import sdist
9+
10+
# Find the install bin subdirectory:
11+
this_file = os.path.join(os.getcwd(), __file__)
12+
this_dir = os.path.abspath(os.path.dirname(this_file))
13+
bin_dir = os.path.abspath(os.path.join(this_dir, 'bin'))
14+
15+
# Now that we've found the bin subdirectory, inject it into the path:
16+
sys.path.insert(0, bin_dir)
17+
18+
# Now we can import some weewx modules
19+
import weewx
20+
VERSION = weewx.__version__
21+
import config_util
22+
23+
#==============================================================================
24+
# sdist
25+
#==============================================================================
26+
27+
class weewx_sdist(sdist):
28+
"""Specialized version of sdist which checks for password information in
29+
the configuration file before creating the distribution.
30+
31+
For other sdist methods, see:
32+
http://epydoc.sourceforge.net/stdlib/distutils.command.sdist.sdist-class.html
33+
"""
34+
35+
def copy_file(self, f, install_dir, **kwargs):
36+
"""Specialized version of copy_file.
37+
38+
Return a tuple (dest_name, copied): 'dest_name' is the actual name of
39+
the output file, and 'copied' is true if the file was copied (or would
40+
have been copied, if 'dry_run' true)."""
41+
# If this is the configuration file, then check it for passwords
42+
if f == 'weewx.conf':
43+
import configobj
44+
config = configobj.ConfigObj(f)
45+
46+
try:
47+
password = config['StdReport']['FTP']['password']
48+
sys.exit("\n*** FTP password found in configuration file. Aborting ***\n\n")
49+
except KeyError:
50+
pass
51+
52+
try:
53+
password = config['StdRESTful']['Wunderground']['password']
54+
sys.exit("\n*** Wunderground password found in configuration file. Aborting ***\n\n")
55+
except KeyError:
56+
pass
57+
58+
try:
59+
password = config['StdRESTful']['Wunderground']['password']
60+
sys.exit("\n*** PWSweather password found in configuration file. Aborting ***\n\n")
61+
except KeyError:
62+
pass
63+
64+
# Pass on to my superclass:
65+
return sdist.copy_file(self, f, install_dir, **kwargs)
66+
67+
#==============================================================================
68+
# main entry point
69+
#==============================================================================
70+
71+
if __name__ == "__main__":
72+
# now invoke the standard python setup
73+
setup(name='weewx',
74+
version=VERSION,
75+
description='weather software',
76+
long_description="weewx interacts with a weather station to produce graphs, "
77+
"reports, and HTML pages. weewx can upload data to services such as the "
78+
"WeatherUnderground, PWSweather.com, or CWOP.",
79+
author='Tom Keffer',
80+
author_email='[email protected]',
81+
url='http://www.weewx.com',
82+
license='GPLv3',
83+
classifiers=['Development Status :: 5 - Production/Stable',
84+
'Intended Audience :: End Users/Desktop',
85+
'License :: GPLv3',
86+
'Operating System :: OS Independent',
87+
'Programming Language :: Python',
88+
'Programming Language :: Python :: 2',
89+
],
90+
requires=['configobj(>=4.5)',
91+
'serial(>=2.3)',
92+
'Cheetah(>=2.0)',
93+
'sqlite3(>=2.5)',
94+
'PIL(>=1.1.6)'],
95+
provides=['weedb',
96+
'weeplot',
97+
'weeutil',
98+
'weewx'],
99+
cmdclass = {"sdist" : weewx_sdist},
100+
# cmdclass = {"install_data": weewx_install_data,
101+
# "install_lib": weewx_install_lib,
102+
# "sdist": weewx_sdist,
103+
# "install_scripts": weewx_install_scripts},
104+
platforms=['any'],
105+
package_dir={'': 'bin'},
106+
packages=['examples',
107+
'schemas',
108+
'user',
109+
'weedb',
110+
'weeplot',
111+
'weeutil',
112+
'weewx',
113+
'weewx.drivers'],
114+
py_modules=['daemon'],
115+
scripts=['bin/wee_config_database',
116+
'bin/wee_config_device',
117+
'bin/weewxd',
118+
'bin/wee_reports'],
119+
)

0 commit comments

Comments
 (0)