Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

pycama / Makefile @ 819:a49c7fad4018

History | View | Annotate | Download (6.39 KB)

1
# Makefile for building the distribution of PyCAMA
2

    
3
# Copyright 2016-2017 Maarten Sneep, KNMI
4
#
5
# Redistribution and use in source and binary forms, with or without
6
# modification, are permitted provided that the following conditions are met:
7
#
8
# 1. Redistributions of source code must retain the above copyright notice,
9
#    this list of conditions and the following disclaimer.
10
#
11
# 2. Redistributions in binary form must reproduce the above copyright notice,
12
#    this list of conditions and the following disclaimer in the documentation
13
#    and/or other materials provided with the distribution.
14
#
15
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
19
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25

    
26
# Ask PyCAMA for its version number
27
#
28
VERSION := $(shell PYTHONPATH=src python3 src/cama.py --version | cut -f2 -d ' ')
29

    
30
# Some tools are different on macOS (Darwin) than on Linux.
31
# (who needs windows?)
32
#
33
UNAME_S := $(shell uname -s)
34
ifeq ($(UNAME_S),Darwin)
35
    RST2HTML=rst2html.py
36
else
37
    RST2HTML=rst2html
38
endif
39

    
40
PYTHON_FILES = \
41
    src/cama_plot_time.py \
42
    src/cama_plot.py \
43
    src/cama.py \
44
    src/check_irradiance.py \
45
    src/concatenate_aggregate.py \
46
    src/create_diff_config.py \
47
    src/create_pycama_joborder.py \
48
    src/extract_lineage.py \
49
    src/flag_counter.py \
50
    src/matplotlib_colormaps.py \
51
    src/plot_s5p_diff.py \
52
    src/plot_s5p_histogram.py \
53
    src/plot_s5p_multi.py \
54
    src/plot_s5p_scatter.py \
55
    src/plot_s5p_spectrum.py \
56
    src/print_core_metadata.py \
57
    src/print_s5p_pixel.py \
58
    src/print_s5p_vars.py \
59
    src/PyCAMA_config_generator.py \
60
    src/sentinel_download.py \
61
    src/surface_classification_flags.py \
62
    src/TM5_profile.py \
63
    src/temis_color_tables.py \
64
    src/pycama/AlongTrackPlot.py \
65
    src/pycama/AnalysisAndPlot.py \
66
    src/pycama/CAMA_call.py \
67
    src/pycama/EventPlot.py \
68
    src/pycama/File.py \
69
    src/pycama/HistogramPlot.py \
70
    src/pycama/__init__.py \
71
    src/pycama/IrradiancePlot.py \
72
    src/pycama/JobOrderParser.py \
73
    src/pycama/OutlinePlot.py \
74
    src/pycama/pqf.py \
75
    src/pycama/Reader.py \
76
    src/pycama/Report.py \
77
    src/pycama/ScatterPlot.py \
78
    src/pycama/utilities.py \
79
    src/pycama/Variable.py \
80
    src/pycama/WorldPlot.py \
81
    src/pycama/ZonalPlot.py \
82
    src/pycama/transform/Filters.py \
83
    src/pycama/transform/__init__.py \
84
    src/pycama/transform/Transformer.py
85

    
86
OTHER_SOURCE=src/pycama/report_template/report_template.tex
87

    
88
# The main target: source dist & readme as HTML.
89
#
90
all: README.html README.txt $(PYTHON_FILES) $(OTHER_SOURCE)
91
	python3 setup.py sdist --formats=gztar,zip
92
	@if [ -f dist/PyCAMA-$(VERSION).tar.gz	]; then echo "cp dist/PyCAMA-$(VERSION).tar.gz ."; cp dist/PyCAMA-$(VERSION).tar.gz .; fi
93
	@if [ -f dist/PyCAMA-$(VERSION).zip	]; then echo "cp dist/PyCAMA-$(VERSION).zip ."; cp dist/PyCAMA-$(VERSION).zip .; fi
94

    
95
# synchronize the version set in setup.py with the version in PyCAMA
96
#
97
sync-version:
98
	sed "s/__version__=\"[0-9]*\.[0-9]*\.[0-9]*\"/__version__=\"$(VERSION)\"/g" < setup.py > tmp
99
	mv tmp setup.py
100

    
101
# for checking the build (trivial, just copying)
102
#
103
build:  $(PYTHON_FILES) $(OTHER_SOURCE)
104
	python3 setup.py --verbose build
105

    
106
# Check the setup script
107
# note that the readme has a duplicate implicit target.
108
# This is a phantom.
109
#
110
check: setup.py README.rst
111
	python3 setup.py --verbose check --metadata
112
	python3 setup.py --verbose check --restructuredtext
113

    
114
# Check the doc (gives line numbers).
115
#
116
check-doc:
117
	rstcheck README.rst
118

    
119
# Try to install to the user account
120
# Note: this installes from the source, not from the packaged bundle.
121
#
122
install-user: README.html README.txt $(PYTHON_FILES) $(OTHER_SOURCE)
123
	python3 setup.py install --user
124

    
125
# Try to install.
126
# Note: this installes from the source, not from the packaged bundle.
127
#
128
install: README.html README.txt $(PYTHON_FILES) $(OTHER_SOURCE)
129
	python3 setup.py install
130

    
131
# Remove all generated files & directories.
132
#
133
clean:
134
	@if [ -d dist ]; then echo "rm -r dist"; rm -r dist; fi
135
	@if [ -d build ]; then echo "rm -r build"; rm -r build; fi
136
	@if [ -f README.html ]; then echo "rm README.html"; rm README.html; fi
137
	@if [ -f README.txt ]; then echo "rm README.txt"; rm README.txt; fi
138
	@if [ -f MANIFEST ]; then echo "rm MANIFEST"; rm MANIFEST; fi
139
	@if [ -f PyCAMA-$(VERSION).zip ]; then echo "rm PyCAMA-$(VERSION).zip"; rm PyCAMA-$(VERSION).zip; fi
140
	@if [ -f PyCAMA-$(VERSION).tar.gz ]; then echo "rm PyCAMA-$(VERSION).tar.gz"; rm PyCAMA-$(VERSION).tar.gz; fi
141
	@if [ -d PyCAMA-$(VERSION) ]; then echo "rm -r PyCAMA-$(VERSION)"; rm -r PyCAMA-$(VERSION); fi
142

    
143
# Build documentation
144
manual:
145
	(cd doc/user_manual/; tropdoc full; tropdoc clean; cd -)
146

    
147
# Build developer documentation
148
doc: $(PYTHON_FILES)
149
	(cd doc/specifications/; doxygen Doxyfile; cd -)
150

    
151
# Build test package
152
test-pkg: 
153
	tar -czvhf ~/nobackup1/PyCAMA-$(VERSION)-TEST.tar.gz test/data/TDI/ test/data/TDO/ test/cases/SYS-001-0[12]* test/cases/SYS-001-00[1-9]*
154

    
155
test-small:
156
	tar -czvhf ~/nobackup1/PyCAMA-$(VERSION)-TEST-small.tar.gz test/data/TDI/SYS-001-001 test/data/TDO/SYS-001-001 test/cases/SYS-001-001*
157

    
158
# build venv environment 
159
venv: README.html README.txt $(PYTHON_FILES) $(OTHER_SOURCE)
160
	./build_venv.sh
161
	
162
# Build separate source balls
163
# (it is more efficient to build them all at once)
164
#
165
dist/PyCAMA-$(VERSION).tar.gz: README.html README.txt $(PYTHON_FILES) $(OTHER_SOURCE)
166
	python3 setup.py sdist --formats=gztar
167

    
168
dist/PyCAMA-$(VERSION).zip: README.html README.txt $(PYTHON_FILES) $(OTHER_SOURCE)
169
	python3 setup.py sdist --formats=zip
170

    
171
# Binary distribution
172
bdist: README.html README.txt $(PYTHON_FILES) $(OTHER_SOURCE)
173
	python3 setup.py bdist --formats=gztar,zip
174

    
175
# Build the readme file as HTML.
176
README.html: README.rst
177
	$(RST2HTML) README.rst > README.html
178

    
179
README.txt: README.rst
180
	pandoc --read=rst --write=plain --output=README.txt README.rst || cp README.rst README.txt