SolarUtils 0.2.2__tar.gz → 0.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. {SolarUtils-0.2.2/SolarUtils.egg-info → home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages/SolarUtils-0.2.3-py2.7.egg-info}/PKG-INFO +3 -2
  2. {SolarUtils-0.2.2/SolarUtils.egg-info → home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages/SolarUtils-0.2.3-py2.7.egg-info}/SOURCES.txt +5 -2
  3. {SolarUtils-0.2.2/SolarUtils.egg-info → home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages/SolarUtils-0.2.3-py2.7.egg-info}/dependency_links.txt +0 -0
  4. home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages/SolarUtils-0.2.3-py2.7.egg-info/requires.txt +4 -0
  5. {SolarUtils-0.2.2/SolarUtils.egg-info → home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages/SolarUtils-0.2.3-py2.7.egg-info}/top_level.txt +0 -0
  6. {SolarUtils-0.2.2 → home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages}/solar_utils/NREL_DISCLAIMERS-COPYRIGHTS-LICENSES.txt +0 -0
  7. {SolarUtils-0.2.2 → home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages}/solar_utils/__init__.py +2 -2
  8. home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages/solar_utils/__init__.pyc +0 -0
  9. {SolarUtils-0.2.2 → home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages}/solar_utils/core.py +0 -0
  10. home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages/solar_utils/core.pyc +0 -0
  11. home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages/solar_utils/dummy.so +0 -0
  12. {SolarUtils-0.2.2 → home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages}/solar_utils/exceptions.py +0 -0
  13. home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages/solar_utils/exceptions.pyc +0 -0
  14. home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages/solar_utils/libsolposAM.so +0 -0
  15. home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages/solar_utils/libspectrl2.so +0 -0
  16. {SolarUtils-0.2.2 → home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages}/solar_utils/tests/__init__.py +0 -0
  17. home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages/solar_utils/tests/__init__.pyc +0 -0
  18. {SolarUtils-0.2.2 → home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages}/solar_utils/tests/test_cdlls.py +0 -0
  19. home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages/solar_utils/tests/test_cdlls.pyc +0 -0
  20. {SolarUtils-0.2.2 → home/marc/.virtualenvs/solarutils/lib/python2.7/site-packages}/solar_utils/tests/test_spectrl2_data.json +0 -0
  21. SolarUtils-0.2.2/CHANGES.rst +0 -39
  22. SolarUtils-0.2.2/LICENSE +0 -28
  23. SolarUtils-0.2.2/MANIFEST.in +0 -8
  24. SolarUtils-0.2.2/PKG-INFO +0 -93
  25. SolarUtils-0.2.2/README.rst +0 -80
  26. SolarUtils-0.2.2/setup.cfg +0 -8
  27. SolarUtils-0.2.2/setup.py +0 -191
  28. SolarUtils-0.2.2/solar_utils/darwin.mk +0 -115
  29. SolarUtils-0.2.2/solar_utils/docs/Makefile +0 -216
  30. SolarUtils-0.2.2/solar_utils/docs/conf.py +0 -299
  31. SolarUtils-0.2.2/solar_utils/docs/core.rst +0 -45
  32. SolarUtils-0.2.2/solar_utils/docs/example.png +0 -0
  33. SolarUtils-0.2.2/solar_utils/docs/exceptions.rst +0 -22
  34. SolarUtils-0.2.2/solar_utils/docs/favicon.ico +0 -0
  35. SolarUtils-0.2.2/solar_utils/docs/index.rst +0 -27
  36. SolarUtils-0.2.2/solar_utils/docs/make.bat +0 -263
  37. SolarUtils-0.2.2/solar_utils/docs/sp_2014_logo_black_orange_rgb.png +0 -0
  38. SolarUtils-0.2.2/solar_utils/dummy.c +0 -12
  39. SolarUtils-0.2.2/solar_utils/libsolposAM.dylib +0 -0
  40. SolarUtils-0.2.2/solar_utils/libspectrl2.dylib +0 -0
  41. SolarUtils-0.2.2/solar_utils/linux.mk +0 -70
  42. SolarUtils-0.2.2/solar_utils/src/README.rst +0 -64
  43. SolarUtils-0.2.2/solar_utils/src/orig/solpos/README.md +0 -6
  44. SolarUtils-0.2.2/solar_utils/src/orig/solpos/SOLPOS Documentation.pdf +0 -0
  45. SolarUtils-0.2.2/solar_utils/src/orig/solpos/solpos.c +0 -999
  46. SolarUtils-0.2.2/solar_utils/src/orig/solpos/solpos00.h +0 -364
  47. SolarUtils-0.2.2/solar_utils/src/orig/solpos/stest00.c +0 -1
  48. SolarUtils-0.2.2/solar_utils/src/orig/spectrl2/README.md +0 -7
  49. SolarUtils-0.2.2/solar_utils/src/orig/spectrl2/SPECTRL2 documentation.pdf +0 -0
  50. SolarUtils-0.2.2/solar_utils/src/orig/spectrl2/spectest.c +0 -188
  51. SolarUtils-0.2.2/solar_utils/src/orig/spectrl2/spectrl2_2.c +0 -496
  52. SolarUtils-0.2.2/solar_utils/src/orig/spectrl2/spectrl2_2.h +0 -178
  53. SolarUtils-0.2.2/solar_utils/src/solpos.c +0 -999
  54. SolarUtils-0.2.2/solar_utils/src/solpos00.h +0 -364
  55. SolarUtils-0.2.2/solar_utils/src/solposAM.c +0 -104
  56. SolarUtils-0.2.2/solar_utils/src/spectest.c +0 -188
  57. SolarUtils-0.2.2/solar_utils/src/spectrl2.c +0 -155
  58. SolarUtils-0.2.2/solar_utils/src/spectrl2_2.c +0 -500
  59. SolarUtils-0.2.2/solar_utils/src/spectrl2_2.h +0 -178
  60. SolarUtils-0.2.2/solar_utils/src/stest00.c +0 -297
  61. SolarUtils-0.2.2/solar_utils/win32.mk +0 -83
@@ -1,6 +1,6 @@
1
- Metadata-Version: 1.0
1
+ Metadata-Version: 2.1
2
2
  Name: SolarUtils
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Python wrappers around NREL SOLPOS and SPECTRL2
5
5
  Home-page: https://github.com/SunPower/SolarUtils
6
6
  Author: Mark Mikofski
@@ -91,3 +91,4 @@ Platform: win32
91
91
  Platform: linux
92
92
  Platform: linux2
93
93
  Platform: darwin
94
+ Provides-Extra: testing
@@ -7,6 +7,7 @@ setup.py
7
7
  SolarUtils.egg-info/PKG-INFO
8
8
  SolarUtils.egg-info/SOURCES.txt
9
9
  SolarUtils.egg-info/dependency_links.txt
10
+ SolarUtils.egg-info/requires.txt
10
11
  SolarUtils.egg-info/top_level.txt
11
12
  solar_utils/NREL_DISCLAIMERS-COPYRIGHTS-LICENSES.txt
12
13
  solar_utils/__init__.py
@@ -14,9 +15,11 @@ solar_utils/core.py
14
15
  solar_utils/darwin.mk
15
16
  solar_utils/dummy.c
16
17
  solar_utils/exceptions.py
17
- solar_utils/libsolposAM.dylib
18
- solar_utils/libspectrl2.dylib
18
+ solar_utils/libsolposAM.so
19
+ solar_utils/libspectrl2.so
19
20
  solar_utils/linux.mk
21
+ solar_utils/solposAM.dll
22
+ solar_utils/spectrl2.dll
20
23
  solar_utils/win32.mk
21
24
  solar_utils/docs/Makefile
22
25
  solar_utils/docs/conf.py
@@ -9,8 +9,8 @@ Do Not Distribute
9
9
 
10
10
  from solar_utils.core import solposAM, spectrl2
11
11
 
12
- __version__ = '0.2.2'
13
- __release__ = 'Bailiffs'
12
+ __version__ = '0.2.3'
13
+ __release__ = 'Beet'
14
14
  __author__ = 'Mark Mikofski'
15
15
  __email__ = 'mark.mikofski@sunpowercorp.com'
16
16
  __url__ = 'https://github.com/SunPower/SolarUtils'
@@ -1,39 +0,0 @@
1
- Changes
2
- =======
3
-
4
- v0.2.1 - Bartenders (2016-07-11)
5
- --------------------------------
6
- * add documentation
7
- * add BSD 3-clause license
8
- * add NREL license and disclaimers
9
- * fix #5 - Wheel made after ``build_ext`` doesn't contain libs
10
-
11
- v0.2 - Bakers (2016-02-23)
12
- --------------------------
13
- * one source for all platforms
14
-
15
- v0.1.4 - Artists (2016-02-22)
16
- ------------------------------
17
- * fixes ``@rpath`` issue with darwin
18
-
19
- v0.1.3 - Actuaries (2016-02-19)
20
- -------------------------------
21
- * compatibility with Python-3
22
-
23
- v0.1.2 - Animal Trainers (2016-02-12)
24
- -------------------------------------
25
- * fix package names not platform specific
26
- * change linux to linux2 everywhere
27
-
28
- v0.1.1 - Actors (2016-02-12)
29
- ----------------------------
30
- * Linux x86-64 wheel with binaries in addition to MS Windows x86-64 wheel
31
- * fixed some namespace clashes
32
- * changed ``solar_utils.py`` to ``core.py``
33
- * changed ``solar_utils_exceptions.py`` to ``exceptions.py``
34
- * conformed to variable naming conventions, removed camelcase, use underscores
35
- * change use of builtin keyword ``code`` as variable to ``err_code``
36
-
37
- v0.1 - Astronauts (2016-02-12)
38
- -------------------------------------
39
- * use pip or setuptools to install
SolarUtils-0.2.2/LICENSE DELETED
@@ -1,28 +0,0 @@
1
- Copyright (c) 2016, SunPower Corp.
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without
5
- modification, are permitted provided that the following conditions are met:
6
-
7
- 1. Redistributions of source code must retain the above copyright notice,
8
- this list of conditions and the following disclaimer.
9
-
10
- 2. Redistributions in binary form must reproduce the above copyright notice,
11
- this list of conditions and the following disclaimer in the documentation
12
- and/or other materials provided with the distribution.
13
-
14
- 3. Neither the name of the copyright holder nor the names of its contributors
15
- may be used to endorse or promote products derived from this software without
16
- specific prior written permission.
17
-
18
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
- POSSIBILITY OF SUCH DAMAGE.
@@ -1,8 +0,0 @@
1
- include LICENSE
2
- include CHANGES.rst
3
- include solar_utils/docs/conf.py
4
- include solar_utils/docs/Makefile
5
- include solar_utils/docs/make.bat
6
- include solar_utils/docs/favicon.ico
7
- recursive-include solar_utils/docs *.png
8
- recursive-include solar_utils/docs *.rst
SolarUtils-0.2.2/PKG-INFO DELETED
@@ -1,93 +0,0 @@
1
- Metadata-Version: 1.0
2
- Name: SolarUtils
3
- Version: 0.2.2
4
- Summary: Python wrappers around NREL SOLPOS and SPECTRL2
5
- Home-page: https://github.com/SunPower/SolarUtils
6
- Author: Mark Mikofski
7
- Author-email: mark.mikofski@sunpowercorp.com
8
- License: BSD 3-Clause
9
- Description: .. image:: https://travis-ci.org/SunPower/SolarUtils.svg?branch=master
10
- :target: https://travis-ci.org/SunPower/SolarUtils
11
-
12
- SolarUtils is set of Python wrappers around the publicly available
13
- `NREL <http://www.nrel.gov/>`_
14
- `SOLPOS <http://rredc.nrel.gov/solar/codesandalgorithms/solpos/>`_ and
15
- `SPECTRL2 <http://rredc.nrel.gov/solar/models/spectral/>`_ C-language computer
16
- programs that calculate solar position and spectral decomposition. Please read
17
- the `NREL disclaimer and license <http://www.nrel.gov/disclaimer.html>`_. Usage
18
- of this software implies acceptance of the terms.
19
-
20
- Installation
21
- ============
22
- Use ``pip`` to install
23
- `SolarUtils from the PyPI <https://pypi.python.org/pypi/SolarUtils>`_::
24
-
25
- pip install SolarUtils
26
-
27
- You can also download a source distribution from PyPI or clone the repository
28
- and use Python ``distutils``::
29
-
30
- python setup.py install
31
-
32
- Requirements
33
- ============
34
- SolarUtils has no requirements for usage however for installation, testing and
35
- to build the documentaiton you will need the following pacakges:
36
-
37
- * NumPy
38
- * PyTest
39
- * Sphinx
40
-
41
- Usage
42
- =====
43
- See `SOLPOS Documentation <http://rredc.nrel.gov/solar/codesandalgorithms/solpos/aboutsolpos.html>`_
44
- and
45
- `SPECTRL2 Documentation <http://rredc.nrel.gov/solar/models/spectral/spectrl2/documentation.html>`_
46
- for more detail.
47
-
48
- Examples
49
- --------
50
-
51
- >>> from solar_utils import *
52
- >>> import pandas as pd
53
- >>> location = [35.56836, -119.2022, -8.0]
54
- >>> datetime = [2013, 6, 5, 12, 31, 0]
55
- >>> weather = [1015.62055, 40.0]
56
- >>> (angles, airmass) = solposAM(location, datetime, weather)
57
- >>> zenith, azimuth = angles
58
- >>> zenith
59
- 15.074043273925781
60
- >>> azimuth
61
- 213.29042053222656]
62
- >>> am, amp = airmass
63
- >>> am
64
- 1.0352272987365723
65
- >>> amp
66
- 1.0379053354263306]
67
-
68
- >>> units = 1
69
- >>> location = [33.65, -84.43, -5.0]
70
- >>> datetime = [1999, 7, 22, 9, 45, 37]
71
- >>> weather = [1006.0, 27.0]
72
- >>> orientation = [33.65, 135.0]
73
- >>> atmospheric_conditions = [1.14, 0.65, -1.0, 0.2, 1.36]
74
- >>> albedo = [0.3, 0.7, 0.8, 1.3, 2.5, 4.0] + ([0.2] * 6)
75
- >>> specdif, specdir, specetr, specglo, specx = spectrl2(
76
- ... units, location, datetime, weather, orientation,
77
- ... atmospheric_conditions, albedo
78
- ... )
79
- >>> spec = pd.DataFrame(
80
- ... {'DIF': specdif, 'DIR': specdir, 'ETR': specetr, 'GLO': specglo},
81
- ... index=specx
82
- ... )
83
- >>> f = spec.plot()
84
- >>> f.set_title('Solar Spectrum Example')
85
- >>> f.set_xlabel('Wavelength, $\lambda [\mu m]$')
86
- >>> f.set_ylabel('Spectral Irradiance, $I_{\lambda} [W/m^2/\mu m]$')
87
- >>> f.grid(True)
88
- >>> f.figure.show()
89
-
90
- Platform: win32
91
- Platform: linux
92
- Platform: linux2
93
- Platform: darwin
@@ -1,80 +0,0 @@
1
- .. image:: https://travis-ci.org/SunPower/SolarUtils.svg?branch=master
2
- :target: https://travis-ci.org/SunPower/SolarUtils
3
-
4
- SolarUtils is set of Python wrappers around the publicly available
5
- `NREL <http://www.nrel.gov/>`_
6
- `SOLPOS <http://rredc.nrel.gov/solar/codesandalgorithms/solpos/>`_ and
7
- `SPECTRL2 <http://rredc.nrel.gov/solar/models/spectral/>`_ C-language computer
8
- programs that calculate solar position and spectral decomposition. Please read
9
- the `NREL disclaimer and license <http://www.nrel.gov/disclaimer.html>`_. Usage
10
- of this software implies acceptance of the terms.
11
-
12
- Installation
13
- ============
14
- Use ``pip`` to install
15
- `SolarUtils from the PyPI <https://pypi.python.org/pypi/SolarUtils>`_::
16
-
17
- pip install SolarUtils
18
-
19
- You can also download a source distribution from PyPI or clone the repository
20
- and use Python ``distutils``::
21
-
22
- python setup.py install
23
-
24
- Requirements
25
- ============
26
- SolarUtils has no requirements for usage however for installation, testing and
27
- to build the documentaiton you will need the following pacakges:
28
-
29
- * NumPy
30
- * PyTest
31
- * Sphinx
32
-
33
- Usage
34
- =====
35
- See `SOLPOS Documentation <http://rredc.nrel.gov/solar/codesandalgorithms/solpos/aboutsolpos.html>`_
36
- and
37
- `SPECTRL2 Documentation <http://rredc.nrel.gov/solar/models/spectral/spectrl2/documentation.html>`_
38
- for more detail.
39
-
40
- Examples
41
- --------
42
-
43
- >>> from solar_utils import *
44
- >>> import pandas as pd
45
- >>> location = [35.56836, -119.2022, -8.0]
46
- >>> datetime = [2013, 6, 5, 12, 31, 0]
47
- >>> weather = [1015.62055, 40.0]
48
- >>> (angles, airmass) = solposAM(location, datetime, weather)
49
- >>> zenith, azimuth = angles
50
- >>> zenith
51
- 15.074043273925781
52
- >>> azimuth
53
- 213.29042053222656]
54
- >>> am, amp = airmass
55
- >>> am
56
- 1.0352272987365723
57
- >>> amp
58
- 1.0379053354263306]
59
-
60
- >>> units = 1
61
- >>> location = [33.65, -84.43, -5.0]
62
- >>> datetime = [1999, 7, 22, 9, 45, 37]
63
- >>> weather = [1006.0, 27.0]
64
- >>> orientation = [33.65, 135.0]
65
- >>> atmospheric_conditions = [1.14, 0.65, -1.0, 0.2, 1.36]
66
- >>> albedo = [0.3, 0.7, 0.8, 1.3, 2.5, 4.0] + ([0.2] * 6)
67
- >>> specdif, specdir, specetr, specglo, specx = spectrl2(
68
- ... units, location, datetime, weather, orientation,
69
- ... atmospheric_conditions, albedo
70
- ... )
71
- >>> spec = pd.DataFrame(
72
- ... {'DIF': specdif, 'DIR': specdir, 'ETR': specetr, 'GLO': specglo},
73
- ... index=specx
74
- ... )
75
- >>> f = spec.plot()
76
- >>> f.set_title('Solar Spectrum Example')
77
- >>> f.set_xlabel('Wavelength, $\lambda [\mu m]$')
78
- >>> f.set_ylabel('Spectral Irradiance, $I_{\lambda} [W/m^2/\mu m]$')
79
- >>> f.grid(True)
80
- >>> f.figure.show()
@@ -1,8 +0,0 @@
1
- [pytest]
2
- norecursedirs = .git build dist venv
3
-
4
- [egg_info]
5
- tag_build =
6
- tag_date = 0
7
- tag_svn_revision = 0
8
-
SolarUtils-0.2.2/setup.py DELETED
@@ -1,191 +0,0 @@
1
- """
2
- SolarUtils Package Setup
3
- Copyright (c) 2016 SunPower Corp.
4
- Confidential & Proprietary
5
- Do Not Distribute
6
- """
7
-
8
- import sys
9
- import os
10
- import shutil
11
- from distutils import unixccompiler
12
- try:
13
- from setuptools import setup, distutils, Extension
14
- except ImportError:
15
- sys.exit('setuptools was not detected - please install setuptools and pip')
16
- from solar_utils import (
17
- __version__ as VERSION, __name__ as NAME, __author__ as AUTHOR,
18
- __email__ as EMAIL, __url__ as URL
19
- )
20
- from solar_utils.tests import test_cdlls
21
- import logging
22
-
23
- logging.basicConfig(level=logging.DEBUG)
24
- LOGGER = logging.getLogger('SETUP')
25
-
26
- README = 'README.rst'
27
- try:
28
- with open(os.path.join(os.path.dirname(__file__), README), 'r') as readme:
29
- README = readme.read()
30
- except IOError:
31
- README = ''
32
-
33
- # set platform constants
34
- CCFLAGS, RPATH, INSTALL_NAME, LDFLAGS, MACROS = None, None, None, None, None
35
- PYVERSION = sys.version_info
36
- PLATFORM = sys.platform
37
- if PLATFORM == 'win32':
38
- LIB_FILE = '%s.dll'
39
- MACROS = [('WIN32', None)]
40
- if PYVERSION.major >= 3 and PYVERSION.minor >= 5:
41
- LDFLAGS = ['/DLL']
42
- elif PLATFORM == 'darwin':
43
- LIB_FILE = 'lib%s.dylib'
44
- RPATH = "-Wl,-rpath,@loader_path/"
45
- INSTALL_NAME = "@rpath/" + LIB_FILE
46
- CCFLAGS = LDFLAGS = ['-fPIC']
47
- elif PLATFORM in ['linux', 'linux2']:
48
- PLATFORM = 'linux'
49
- LIB_FILE = 'lib%s.so'
50
- RPATH = "-Wl,-rpath,${ORIGIN}"
51
- CCFLAGS = LDFLAGS = ['-fPIC']
52
- else:
53
- sys.exit('Platform "%s" is unknown or unsupported.' % PLATFORM)
54
-
55
-
56
- def make_ldflags(ldflags=LDFLAGS, rpath=RPATH):
57
- """
58
- Make LDFLAGS with rpath, install_name and lib_name.
59
- """
60
- if ldflags and rpath:
61
- ldflags.extend([rpath])
62
- elif rpath:
63
- ldflags = [rpath]
64
- return ldflags
65
-
66
-
67
- def make_install_name(lib_name, install_name=INSTALL_NAME):
68
- """
69
- Make INSTALL_NAME with and lib_name.
70
- """
71
- if install_name:
72
- return ['-install_name', install_name % lib_name]
73
- else:
74
- return None
75
-
76
-
77
- def dylib_monkeypatch(self):
78
- """
79
- Monkey patch :class:`distutils.UnixCCompiler` for darwin so libraries use
80
- '.dylib' instead of '.so'.
81
-
82
- """
83
- def link_dylib_lib(self, objects, output_libname, output_dir=None,
84
- libraries=None, library_dirs=None,
85
- runtime_library_dirs=None, export_symbols=None,
86
- debug=0, extra_preargs=None, extra_postargs=None,
87
- build_temp=None, target_lang=None):
88
- """implementation of link_shared_lib"""
89
- self.link("shared_library", objects,
90
- self.library_filename(output_libname, lib_type='dylib'),
91
- output_dir,
92
- libraries, library_dirs, runtime_library_dirs,
93
- export_symbols, debug,
94
- extra_preargs, extra_postargs, build_temp, target_lang)
95
- self.link_so = self.link_shared_lib
96
- self.link_shared_lib = link_dylib_lib
97
- return self
98
-
99
-
100
- # use dummy to get correct platform metadata
101
- PKG_DATA = ['NREL_DISCLAIMERS-COPYRIGHTS-LICENSES.txt']
102
- DUMMY = Extension('%s.dummy' % NAME, sources=[os.path.join(NAME, 'dummy.c')])
103
- SRC_DIR = os.path.join(NAME, 'src')
104
- BUILD_DIR = os.path.join(NAME, 'build')
105
- TESTS = '%s.tests' % NAME
106
- TEST_DATA = ['test_spectrl2_data.json']
107
- SOLPOS = 'solpos.c'
108
- SOLPOSAM = 'solposAM.c'
109
- SOLPOSAM_LIB = 'solposAM'
110
- SOLPOSAM_LIB_FILE = LIB_FILE % SOLPOSAM_LIB
111
- SPECTRL2 = 'spectrl2.c'
112
- SPECTRL2_2 = 'spectrl2_2.c'
113
- SPECTRL2_LIB = 'spectrl2'
114
- SPECTRL2_LIB_FILE = LIB_FILE % SPECTRL2_LIB
115
- SOLPOS = os.path.join(SRC_DIR, SOLPOS)
116
- SOLPOSAM = os.path.join(SRC_DIR, SOLPOSAM)
117
- SPECTRL2 = os.path.join(SRC_DIR, SPECTRL2)
118
- SPECTRL2_2 = os.path.join(SRC_DIR, SPECTRL2_2)
119
- SOLPOSAM_LIB_PATH = os.path.join(NAME, SOLPOSAM_LIB_FILE)
120
- SPECTRL2_LIB_PATH = os.path.join(NAME, SPECTRL2_LIB_FILE)
121
- LIB_FILES_EXIST = all([
122
- os.path.exists(SOLPOSAM_LIB_PATH),
123
- os.path.exists(SPECTRL2_LIB_PATH)
124
- ])
125
-
126
- # run clean or build libraries if they don't exist
127
- if 'clean' in sys.argv:
128
- try:
129
- os.remove(SOLPOSAM_LIB_PATH)
130
- os.remove(SPECTRL2_LIB_PATH)
131
- except OSError as err:
132
- sys.stderr.write('%s\n' % err)
133
- elif 'sdist' in sys.argv:
134
- for plat in ('win32', 'linux', 'darwin'):
135
- PKG_DATA.append('%s.mk' % plat)
136
- PKG_DATA.append(os.path.join('src', '*.*'))
137
- PKG_DATA.append(os.path.join('src', 'orig', 'solpos', '*.*'))
138
- PKG_DATA.append(os.path.join('src', 'orig', 'spectrl2', '*.*'))
139
- elif not LIB_FILES_EXIST:
140
- # clean build directory
141
- if os.path.exists(BUILD_DIR):
142
- shutil.rmtree(BUILD_DIR) # delete entire directory tree
143
- os.mkdir(BUILD_DIR) # make build directory
144
- # compile NREL source code
145
- if PLATFORM == 'darwin':
146
- CCOMPILER = unixccompiler.UnixCCompiler
147
- OSXCCOMPILER = dylib_monkeypatch(CCOMPILER)
148
- CC = OSXCCOMPILER(verbose=3)
149
- else:
150
- CC = distutils.ccompiler.new_compiler() # initialize compiler object
151
- CC.add_include_dir(SRC_DIR) # set includes directory
152
- # compile solpos and solposAM objects into build directory
153
- OBJS = CC.compile([SOLPOS, SOLPOSAM], output_dir=BUILD_DIR,
154
- extra_preargs=CCFLAGS, macros=MACROS)
155
- # link objects and make shared library in build directory
156
- CC.link_shared_lib(OBJS, SOLPOSAM_LIB, output_dir=BUILD_DIR,
157
- extra_preargs=make_ldflags(),
158
- extra_postargs=make_install_name(SOLPOSAM_LIB))
159
- # compile spectrl2 objects into build directory
160
- OBJS = CC.compile([SPECTRL2, SPECTRL2_2, SOLPOS], output_dir=BUILD_DIR,
161
- extra_preargs=CCFLAGS, macros=MACROS)
162
- CC.add_library(SOLPOSAM_LIB) # set linked libraries
163
- CC.add_library_dir(BUILD_DIR) # set library directories
164
- # link objects and make shared library in build directory
165
- CC.link_shared_lib(OBJS, SPECTRL2_LIB, output_dir=BUILD_DIR,
166
- extra_preargs=make_ldflags(),
167
- extra_postargs=make_install_name(SPECTRL2_LIB))
168
- # copy files from build to library folder
169
- shutil.copy(os.path.join(BUILD_DIR, SOLPOSAM_LIB_FILE), NAME)
170
- shutil.copy(os.path.join(BUILD_DIR, SPECTRL2_LIB_FILE), NAME)
171
- # test libraries
172
- test_cdlls.test_solposAM()
173
- test_cdlls.test_spectrl2()
174
- LIB_FILES_EXIST = True
175
- if LIB_FILES_EXIST and 'sdist' not in sys.argv:
176
- PKG_DATA += [SOLPOSAM_LIB_FILE, SPECTRL2_LIB_FILE]
177
-
178
- setup(
179
- name='SolarUtils',
180
- version=VERSION,
181
- description='Python wrappers around NREL SOLPOS and SPECTRL2',
182
- long_description=README,
183
- author=AUTHOR,
184
- author_email=EMAIL,
185
- url=URL,
186
- license='BSD 3-Clause',
187
- platforms=['win32', 'linux', 'linux2', 'darwin'],
188
- packages=[NAME, TESTS],
189
- package_data={NAME: PKG_DATA, TESTS: TEST_DATA},
190
- ext_modules=[DUMMY]
191
- )
@@ -1,115 +0,0 @@
1
- #define macros
2
- SOLPOSAM = libsolposAM.dylib
3
- SOLPOSAM_LIB = solposAM
4
- SPECTRL2 = libspectrl2.dylib
5
- SPECTEST = spectest
6
- STEST00 = stest00
7
-
8
- SRC_DIR = src
9
- BUILD_DIR = build
10
-
11
- SOLPOSAM_SRC = \
12
- $(SRC_DIR)/solposAM.c \
13
- $(SRC_DIR)/solpos.c
14
-
15
- SPECTRL2_SRC = \
16
- $(SRC_DIR)/spectrl2.c \
17
- $(SRC_DIR)/spectrl2_2.c \
18
- $(SRC_DIR)/solpos.c
19
-
20
- SPECTEST_SRC = \
21
- $(SRC_DIR)/spectest.c \
22
- $(SRC_DIR)/spectrl2_2.c \
23
- $(SRC_DIR)/solpos.c
24
-
25
- STEST00_SRC = \
26
- $(SRC_DIR)/stest00.c \
27
- $(SRC_DIR)/solpos.c
28
-
29
- SOLPOSAM_LOG = $(BUILD_DIR)/solposAM.log
30
- SPECTRL2_LOG = $(BUILD_DIR)/spectrl2.log
31
-
32
- all: uninstall clean solposAM spectrl2 install test
33
-
34
- clean:
35
- rm -rf $(BUILD_DIR)
36
-
37
- create_dirs:
38
- mkdir -p $(BUILD_DIR)
39
-
40
- solposAM: create_dirs
41
- cc -Wl,-rpath,@loader_path/ -shared -fPIC -Wall $(SOLPOSAM_SRC) \
42
- -o $(BUILD_DIR)/$(SOLPOSAM) -install_name @rpath/$(SOLPOSAM)
43
-
44
- spectrl2: create_dirs
45
- cc -L$(BUILD_DIR) -Wl,-rpath,@loader_path/ -shared -fPIC -Wall \
46
- $(SPECTRL2_SRC) -o $(BUILD_DIR)/$(SPECTRL2) -l$(SOLPOSAM_LIB) \
47
- -install_name @rpath/$(SPECTRL2)
48
-
49
- install:
50
- install $(BUILD_DIR)/*.dylib ./
51
-
52
- uninstall:
53
- rm -f $(SOLPOSAM) $(SPECTRL2)
54
-
55
- spectest:
56
- cc -fPIC -Wall $(SPECTEST_SRC) -o $(BUILD_DIR)/$(SPECTEST)
57
-
58
- stest00:
59
- cc -fPIC -Wall $(STEST00_SRC) -o $(BUILD_DIR)/$(STEST00)
60
-
61
- test: spectest stest00
62
- $(BUILD_DIR)/$(SPECTEST) >> SPECTRL2_LOG
63
- $(BUILD_DIR)/$(STEST00) >> SOLPOSAM_LOG
64
-
65
- # https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html
66
- # -Wl,option
67
- # Pass option as an option to the linker. If option contains commas, it is
68
- # split into multiple options at the commas. You can use this syntax to pass
69
- # an argument to the option. For example, -Wl,-Map,output.map passes
70
- # -Map output.map to the linker. When using the GNU linker, you can also get
71
- # the same effect with -Wl,-Map=output.map.
72
-
73
- # https://gcc.gnu.org/onlinedocs/gcc/Darwin-Options.html
74
- # -install_name <path>
75
-
76
- # https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/RunpathDependentLibraries.html
77
- # -install_name <path>
78
-
79
- # https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkBinding.html
80
- # otool
81
-
82
- # https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcode-select.1.html
83
- # install_name_tool
84
-
85
- # https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/dyld.1.html
86
- # @loader_path/
87
- # This variable is replaced with the path to the directory containing the mach-o binary which
88
- # contains the load command using @loader_path. Thus, in every binary, @loader_path resolves to
89
- # a different path, whereas @executable_path always resolves to the same path. @loader_path is
90
- # useful as the load path for a framework/dylib embedded in a plug-in, if the final file system
91
- # location of the plugin-in unknown (so absolute paths cannot be used) or if the plug-in is used
92
- # by multiple applications (so @executable_path cannot be used). If the plug-in mach-o file is
93
- # at /some/path/Myfilter.plugin/Contents/MacOS/Myfilter and a framework dylib file is at
94
- # /some/path/Myfilter.plugin/Contents/Frameworks/Foo.framework/Versions/A/Foo, then the frame-work framework
95
- # work load path could be encoded as @loader_path/../Frameworks/Foo.framework/Versions/A/Foo and
96
- # the Myfilter.plugin directory could be moved around in the file system and dyld will still be
97
- # able to load the embedded framework.
98
- #
99
- # @rpath/
100
- # Dyld maintains a current stack of paths called the run path list. When @rpath is encountered
101
- # it is substituted with each path in the run path list until a loadable dylib if found. The
102
- # run path stack is built from the LC_RPATH load commands in the depencency chain that lead to
103
- # the current dylib load. You can add an LC_RPATH load command to an image with the -rpath
104
- # option to ld(1). You can even add a LC_RPATH load command path that starts with
105
- # @loader_path/, and it will push a path on the run path stack that relative to the image con-taining containing
106
- # taining the LC_RPATH. The use of @rpath is most useful when you have a complex directory
107
- # structure of programs and dylibs which can be installed anywhere, but keep their relative
108
- # positions. This scenario could be implemented using @loader_path, but every client of a dylib
109
- # could need a different load path because its relative position in the file system is differ-ent. different.
110
- # ent. The use of @rpath introduces a level of indirection that simplies things. You pick a
111
- # location in your directory structure as an anchor point. Each dylib then gets an install path
112
- # that starts with @rpath and is the path to the dylib relative to the anchor point. Each main
113
- # executable is linked with -rpath @loader_path/zzz, where zzz is the path from the executable
114
- # to the anchor point. At runtime dyld sets it run path to be the anchor point, then each dylib
115
- # is found relative to the anchor point.