desiutil 3.5.0__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.
- desiutil-3.5.0/LICENSE.rst +25 -0
- desiutil-3.5.0/MANIFEST.in +2 -0
- desiutil-3.5.0/PKG-INFO +77 -0
- desiutil-3.5.0/README.rst +37 -0
- desiutil-3.5.0/bin/annotate_fits +6 -0
- desiutil-3.5.0/bin/desiBootstrap.sh +112 -0
- desiutil-3.5.0/bin/desiInstall +6 -0
- desiutil-3.5.0/bin/desi_api_file +6 -0
- desiutil-3.5.0/bin/desi_module_file +6 -0
- desiutil-3.5.0/bin/desi_update_version +6 -0
- desiutil-3.5.0/bin/fix_permissions.sh +135 -0
- desiutil-3.5.0/bin/update_iers_frozen +9 -0
- desiutil-3.5.0/py/desiutil/__init__.py +15 -0
- desiutil-3.5.0/py/desiutil/_version.py +1 -0
- desiutil-3.5.0/py/desiutil/annotate.py +557 -0
- desiutil-3.5.0/py/desiutil/api.py +112 -0
- desiutil-3.5.0/py/desiutil/bitmask.py +289 -0
- desiutil-3.5.0/py/desiutil/brick.py +416 -0
- desiutil-3.5.0/py/desiutil/census.py +460 -0
- desiutil-3.5.0/py/desiutil/data/DES_footprint.txt +2389 -0
- desiutil-3.5.0/py/desiutil/data/Leap_Second.dat +41 -0
- desiutil-3.5.0/py/desiutil/data/census.yaml +140 -0
- desiutil-3.5.0/py/desiutil/data/desiutil.module +77 -0
- desiutil-3.5.0/py/desiutil/data/iers_frozen.ecsv +16623 -0
- desiutil-3.5.0/py/desiutil/depend.py +375 -0
- desiutil-3.5.0/py/desiutil/dust.py +886 -0
- desiutil-3.5.0/py/desiutil/funcfits.py +245 -0
- desiutil-3.5.0/py/desiutil/git.py +76 -0
- desiutil-3.5.0/py/desiutil/iers.py +214 -0
- desiutil-3.5.0/py/desiutil/install.py +1076 -0
- desiutil-3.5.0/py/desiutil/io.py +315 -0
- desiutil-3.5.0/py/desiutil/log.py +227 -0
- desiutil-3.5.0/py/desiutil/modules.py +355 -0
- desiutil-3.5.0/py/desiutil/names.py +82 -0
- desiutil-3.5.0/py/desiutil/plots.py +1128 -0
- desiutil-3.5.0/py/desiutil/redirect.py +252 -0
- desiutil-3.5.0/py/desiutil/setup.py +285 -0
- desiutil-3.5.0/py/desiutil/sklearn.py +133 -0
- desiutil-3.5.0/py/desiutil/stats.py +32 -0
- desiutil-3.5.0/py/desiutil/svn.py +102 -0
- desiutil-3.5.0/py/desiutil/test/__init__.py +35 -0
- desiutil-3.5.0/py/desiutil/test/make_testmaps.py +21 -0
- desiutil-3.5.0/py/desiutil/test/t/SFD_dust_4096_ngp.fits +0 -0
- desiutil-3.5.0/py/desiutil/test/t/SFD_dust_4096_sgp.fits +0 -0
- desiutil-3.5.0/py/desiutil/test/t/generic_dependencies.txt +5 -0
- desiutil-3.5.0/py/desiutil/test/t/qso_gmm.fits +0 -0
- desiutil-3.5.0/py/desiutil/test/t/test.module +2 -0
- desiutil-3.5.0/py/desiutil/test/t/test_fix_permissions.sh +75 -0
- desiutil-3.5.0/py/desiutil/test/test_annotate.py +437 -0
- desiutil-3.5.0/py/desiutil/test/test_api.py +81 -0
- desiutil-3.5.0/py/desiutil/test/test_bitmask.py +183 -0
- desiutil-3.5.0/py/desiutil/test/test_brick.py +393 -0
- desiutil-3.5.0/py/desiutil/test/test_census.py +207 -0
- desiutil-3.5.0/py/desiutil/test/test_depend.py +324 -0
- desiutil-3.5.0/py/desiutil/test/test_dust.py +188 -0
- desiutil-3.5.0/py/desiutil/test/test_funcfits.py +135 -0
- desiutil-3.5.0/py/desiutil/test/test_git.py +108 -0
- desiutil-3.5.0/py/desiutil/test/test_iers.py +167 -0
- desiutil-3.5.0/py/desiutil/test/test_install.py +846 -0
- desiutil-3.5.0/py/desiutil/test/test_io.py +208 -0
- desiutil-3.5.0/py/desiutil/test/test_log.py +229 -0
- desiutil-3.5.0/py/desiutil/test/test_modules.py +291 -0
- desiutil-3.5.0/py/desiutil/test/test_names.py +81 -0
- desiutil-3.5.0/py/desiutil/test/test_plots.py +160 -0
- desiutil-3.5.0/py/desiutil/test/test_redirect.py +196 -0
- desiutil-3.5.0/py/desiutil/test/test_setup.py +211 -0
- desiutil-3.5.0/py/desiutil/test/test_sklearn.py +107 -0
- desiutil-3.5.0/py/desiutil/test/test_stats.py +29 -0
- desiutil-3.5.0/py/desiutil/test/test_svn.py +110 -0
- desiutil-3.5.0/py/desiutil/test/test_timer.py +188 -0
- desiutil-3.5.0/py/desiutil/test/test_top_level.py +32 -0
- desiutil-3.5.0/py/desiutil/timer.py +352 -0
- desiutil-3.5.0/py/desiutil.egg-info/PKG-INFO +77 -0
- desiutil-3.5.0/py/desiutil.egg-info/SOURCES.txt +80 -0
- desiutil-3.5.0/py/desiutil.egg-info/dependency_links.txt +1 -0
- desiutil-3.5.0/py/desiutil.egg-info/requires.txt +22 -0
- desiutil-3.5.0/py/desiutil.egg-info/top_level.txt +1 -0
- desiutil-3.5.0/py/desiutil.egg-info/zip-safe +1 -0
- desiutil-3.5.0/pyproject.toml +4 -0
- desiutil-3.5.0/setup.cfg +100 -0
- desiutil-3.5.0/setup.py +85 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Copyright (c) 2014-2019, DESI Collaboration <desi-data@desi.lbl.gov>
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
5
|
+
are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
* Redistributions in binary form must reproduce the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer in the documentation and/or
|
|
11
|
+
other materials provided with the distribution.
|
|
12
|
+
* Neither the name of the DESI Collaboration nor the names of its contributors
|
|
13
|
+
may be used to endorse or promote products derived from
|
|
14
|
+
this software without specific prior written permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
17
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
18
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
20
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
21
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
22
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
23
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
24
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
25
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
desiutil-3.5.0/PKG-INFO
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: desiutil
|
|
3
|
+
Version: 3.5.0
|
|
4
|
+
Summary: DESI utilities package
|
|
5
|
+
Home-page: https://github.com/desihub/desiutil
|
|
6
|
+
Author: DESI Collaboration
|
|
7
|
+
Author-email: desi-data@desi.lbl.gov
|
|
8
|
+
License: BSD 3-Clause License
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
16
|
+
Classifier: Topic :: System :: Software Distribution
|
|
17
|
+
Classifier: Topic :: Utilities
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/x-rst
|
|
20
|
+
License-File: LICENSE.rst
|
|
21
|
+
Requires-Dist: requests
|
|
22
|
+
Requires-Dist: pyyaml
|
|
23
|
+
Requires-Dist: astropy<7
|
|
24
|
+
Provides-Extra: all
|
|
25
|
+
Requires-Dist: healpy; extra == "all"
|
|
26
|
+
Requires-Dist: matplotlib; extra == "all"
|
|
27
|
+
Requires-Dist: scipy; extra == "all"
|
|
28
|
+
Requires-Dist: speclite; extra == "all"
|
|
29
|
+
Provides-Extra: test
|
|
30
|
+
Requires-Dist: desiutil[all]; extra == "test"
|
|
31
|
+
Requires-Dist: pytest; extra == "test"
|
|
32
|
+
Provides-Extra: coverage
|
|
33
|
+
Requires-Dist: desiutil[all]; extra == "coverage"
|
|
34
|
+
Requires-Dist: pytest-cov; extra == "coverage"
|
|
35
|
+
Requires-Dist: coveralls; extra == "coverage"
|
|
36
|
+
Provides-Extra: doc
|
|
37
|
+
Requires-Dist: Sphinx; extra == "doc"
|
|
38
|
+
Requires-Dist: sphinx-rtd-theme; extra == "doc"
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
|
|
41
|
+
========
|
|
42
|
+
desiutil
|
|
43
|
+
========
|
|
44
|
+
|
|
45
|
+
|Actions Status| |Coveralls Status| |Documentation Status|
|
|
46
|
+
|
|
47
|
+
.. |Actions Status| image:: https://github.com/desihub/desiutil/workflows/CI/badge.svg
|
|
48
|
+
:target: https://github.com/desihub/desiutil/actions
|
|
49
|
+
:alt: GitHub Actions CI Status
|
|
50
|
+
|
|
51
|
+
.. |Coveralls Status| image:: https://coveralls.io/repos/desihub/desiutil/badge.svg
|
|
52
|
+
:target: https://coveralls.io/github/desihub/desiutil
|
|
53
|
+
:alt: Test Coverage Status
|
|
54
|
+
|
|
55
|
+
.. |Documentation Status| image:: https://readthedocs.org/projects/desiutil/badge/?version=latest
|
|
56
|
+
:target: https://desiutil.readthedocs.io/en/latest/
|
|
57
|
+
:alt: Documentation Status
|
|
58
|
+
|
|
59
|
+
Introduction
|
|
60
|
+
============
|
|
61
|
+
|
|
62
|
+
`desiutil` contains general purpose tools for use by any and all other `DESI packages`_.
|
|
63
|
+
|
|
64
|
+
.. _`DESI packages`: https://github.com/desihub
|
|
65
|
+
|
|
66
|
+
Full Documentation
|
|
67
|
+
==================
|
|
68
|
+
|
|
69
|
+
Please visit `desiutil on Read the Docs`_.
|
|
70
|
+
|
|
71
|
+
.. _`desiutil on Read the Docs`: https://desiutil.readthedocs.io/en/latest/
|
|
72
|
+
|
|
73
|
+
License
|
|
74
|
+
=======
|
|
75
|
+
|
|
76
|
+
desiutil is free software licensed under a 3-clause BSD-style license. For details see
|
|
77
|
+
the ``LICENSE.rst`` file.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
========
|
|
2
|
+
desiutil
|
|
3
|
+
========
|
|
4
|
+
|
|
5
|
+
|Actions Status| |Coveralls Status| |Documentation Status|
|
|
6
|
+
|
|
7
|
+
.. |Actions Status| image:: https://github.com/desihub/desiutil/workflows/CI/badge.svg
|
|
8
|
+
:target: https://github.com/desihub/desiutil/actions
|
|
9
|
+
:alt: GitHub Actions CI Status
|
|
10
|
+
|
|
11
|
+
.. |Coveralls Status| image:: https://coveralls.io/repos/desihub/desiutil/badge.svg
|
|
12
|
+
:target: https://coveralls.io/github/desihub/desiutil
|
|
13
|
+
:alt: Test Coverage Status
|
|
14
|
+
|
|
15
|
+
.. |Documentation Status| image:: https://readthedocs.org/projects/desiutil/badge/?version=latest
|
|
16
|
+
:target: https://desiutil.readthedocs.io/en/latest/
|
|
17
|
+
:alt: Documentation Status
|
|
18
|
+
|
|
19
|
+
Introduction
|
|
20
|
+
============
|
|
21
|
+
|
|
22
|
+
`desiutil` contains general purpose tools for use by any and all other `DESI packages`_.
|
|
23
|
+
|
|
24
|
+
.. _`DESI packages`: https://github.com/desihub
|
|
25
|
+
|
|
26
|
+
Full Documentation
|
|
27
|
+
==================
|
|
28
|
+
|
|
29
|
+
Please visit `desiutil on Read the Docs`_.
|
|
30
|
+
|
|
31
|
+
.. _`desiutil on Read the Docs`: https://desiutil.readthedocs.io/en/latest/
|
|
32
|
+
|
|
33
|
+
License
|
|
34
|
+
=======
|
|
35
|
+
|
|
36
|
+
desiutil is free software licensed under a 3-clause BSD-style license. For details see
|
|
37
|
+
the ``LICENSE.rst`` file.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Licensed under a 3-clause BSD style license - see LICENSE.rst
|
|
4
|
+
#
|
|
5
|
+
function usage() {
|
|
6
|
+
local execName=$(basename $0)
|
|
7
|
+
(
|
|
8
|
+
echo "${execName} [-a VERSION] [-b BRANCH] [-c CONFIG] [-h] [-m MODULESHOME] [-p PYTHON] [-t] [-v]"
|
|
9
|
+
echo ""
|
|
10
|
+
echo "Install desiutil on a bare system."
|
|
11
|
+
echo ""
|
|
12
|
+
echo " -a = Version of DESI+Anaconda software stack."
|
|
13
|
+
echo " -b = Switch to desiutil BRANCH before installing."
|
|
14
|
+
echo " -c = Pass CONFIG to desiInstall."
|
|
15
|
+
echo " -h = Print this message and exit."
|
|
16
|
+
echo " -m = Look for the Modules install in MODULESHOME."
|
|
17
|
+
echo " -p = Use the Python executable PYTHON (e.g. /opt/local/bin/python2.7)."
|
|
18
|
+
echo " -t = Test mode. Do not make any changes. Implies -v."
|
|
19
|
+
echo " -v = Verbose mode. Print lots of extra information."
|
|
20
|
+
) >&2
|
|
21
|
+
}
|
|
22
|
+
#
|
|
23
|
+
# Get options
|
|
24
|
+
#
|
|
25
|
+
anaconda='current'
|
|
26
|
+
branch=''
|
|
27
|
+
config=''
|
|
28
|
+
modules=''
|
|
29
|
+
py=''
|
|
30
|
+
test=''
|
|
31
|
+
verbose=''
|
|
32
|
+
while getopts a:b:c:hm:p:tv argname; do
|
|
33
|
+
case ${argname} in
|
|
34
|
+
a) anaconda=${OPTARG} ;;
|
|
35
|
+
b) branch=${OPTARG} ;;
|
|
36
|
+
c) config="-c ${OPTARG}" ;;
|
|
37
|
+
h) usage; exit 0 ;;
|
|
38
|
+
m) modules=${OPTARG} ;;
|
|
39
|
+
p) py=${OPTARG} ;;
|
|
40
|
+
t) test='-t'; verbose='-v' ;;
|
|
41
|
+
v) verbose='-v' ;;
|
|
42
|
+
*) usage; exit 1 ;;
|
|
43
|
+
esac
|
|
44
|
+
done
|
|
45
|
+
shift $((OPTIND-1))
|
|
46
|
+
#
|
|
47
|
+
# Validate options
|
|
48
|
+
#
|
|
49
|
+
if [[ -z "${DESI_PRODUCT_ROOT}" && -z "${NERSC_HOST}" ]]; then
|
|
50
|
+
echo "You haven't set the DESI_PRODUCT_ROOT environment variable."
|
|
51
|
+
echo "I'm not going to try to guess where you want to install things."
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
if [[ -n "${modules}" ]]; then
|
|
55
|
+
export MODULESHOME=${modules}
|
|
56
|
+
fi
|
|
57
|
+
if [[ -z "${MODULESHOME}" ]]; then
|
|
58
|
+
echo "You do not appear to have Modules installed."
|
|
59
|
+
exit 1
|
|
60
|
+
fi
|
|
61
|
+
if [[ -n "${NERSC_HOST}" && -z "${py}" ]]; then
|
|
62
|
+
#
|
|
63
|
+
# Make certain we are using the Python version associated with the
|
|
64
|
+
# specified DESI+Anaconda stack.
|
|
65
|
+
#
|
|
66
|
+
desiconda=/global/common/software/desi/${NERSC_HOST}/desiconda/${anaconda}
|
|
67
|
+
if [[ -d ${desiconda} ]]; then
|
|
68
|
+
if [[ "${anaconda}" == "current" ]]; then
|
|
69
|
+
anaconda=$(readlink ${desiconda})
|
|
70
|
+
dd=$(dirname ${desiconda})/${anaconda}
|
|
71
|
+
else
|
|
72
|
+
dd=${desiconda}
|
|
73
|
+
fi
|
|
74
|
+
py=${dd}/conda/bin/python
|
|
75
|
+
if [[ ! -x ${py} ]]; then
|
|
76
|
+
echo "Python executable ${py} not found!"
|
|
77
|
+
exit 1
|
|
78
|
+
fi
|
|
79
|
+
fi
|
|
80
|
+
if [[ -z "${py}" ]]; then
|
|
81
|
+
echo "Could not find Python executable associated with '${anaconda}' on ${NERSC_HOST}!"
|
|
82
|
+
exit 1
|
|
83
|
+
fi
|
|
84
|
+
fi
|
|
85
|
+
#
|
|
86
|
+
# Export
|
|
87
|
+
#
|
|
88
|
+
checkout=desiutil-checkout
|
|
89
|
+
[[ -n "${verbose}" ]] && echo git clone https://github.com/desihub/desiutil.git ${checkout}
|
|
90
|
+
git clone https://github.com/desihub/desiutil.git ${checkout}
|
|
91
|
+
if [[ -n "${branch}" ]]; then
|
|
92
|
+
cd ${checkout}
|
|
93
|
+
[[ -n "${verbose}" ]] && echo git checkout ${branch}
|
|
94
|
+
git checkout ${branch}
|
|
95
|
+
cd ..
|
|
96
|
+
fi
|
|
97
|
+
export DESIUTIL=$(pwd)/${checkout}
|
|
98
|
+
export PATH=${DESIUTIL}/bin:${PATH}
|
|
99
|
+
if [[ -z "${PYTHONPATH}" ]]; then
|
|
100
|
+
export PYTHONPATH=${DESIUTIL}/py
|
|
101
|
+
else
|
|
102
|
+
export PYTHONPATH=${DESIUTIL}/py:${PYTHONPATH}
|
|
103
|
+
fi
|
|
104
|
+
if [[ -z "${py}" ]]; then
|
|
105
|
+
[[ -n "${verbose}" ]] && echo desiInstall -a ${anaconda} -b ${config} ${test} ${verbose}
|
|
106
|
+
desiInstall -a ${anaconda} -b ${config} ${test} ${verbose}
|
|
107
|
+
else
|
|
108
|
+
[[ -n "${verbose}" ]] && echo ${py} ${DESIUTIL}/bin/desiInstall -a ${anaconda} -b ${config} ${test} ${verbose}
|
|
109
|
+
${py} ${DESIUTIL}/bin/desiInstall -a ${anaconda} -b ${config} ${test} ${verbose}
|
|
110
|
+
fi
|
|
111
|
+
[[ -n "${verbose}" ]] && echo /bin/rm -rf ${DESIUTIL}
|
|
112
|
+
/bin/rm -rf ${DESIUTIL}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# Licensed under a 3-clause BSD style license - see LICENSE.rst
|
|
4
|
+
#
|
|
5
|
+
# See https://desi.lbl.gov/trac/wiki/Computing/NerscFileSystem#FileSystemAccess
|
|
6
|
+
# for the detailed requirements that motivate this script.
|
|
7
|
+
#
|
|
8
|
+
function usage() {
|
|
9
|
+
local execName=$(basename $0)
|
|
10
|
+
(
|
|
11
|
+
echo "${execName} [-a] [-g GROUP] [-h] [-t] [-v] DIR"
|
|
12
|
+
echo ""
|
|
13
|
+
echo "Set group-friendly permissions on a directory tree."
|
|
14
|
+
echo ""
|
|
15
|
+
echo " -a = Include apache/www access (via ACL) when modifying permissions."
|
|
16
|
+
echo " -g = Change group ownership to GROUP (default 'desi')."
|
|
17
|
+
echo " -h = Print this message and exit."
|
|
18
|
+
echo " -t = Test mode. Do not make any changes. Implies -v."
|
|
19
|
+
echo " -v = Verbose mode. Print lots of extra information."
|
|
20
|
+
echo " DIR = Directory to fix. Required."
|
|
21
|
+
) >&2
|
|
22
|
+
}
|
|
23
|
+
#
|
|
24
|
+
#
|
|
25
|
+
#
|
|
26
|
+
function run() {
|
|
27
|
+
local vrb=$1
|
|
28
|
+
local cmd=$2
|
|
29
|
+
${vrb} && echo "${cmd}"
|
|
30
|
+
${cmd}
|
|
31
|
+
}
|
|
32
|
+
#
|
|
33
|
+
# Get options
|
|
34
|
+
#
|
|
35
|
+
apacheACL=''
|
|
36
|
+
apacheUID=48
|
|
37
|
+
desiGID=desi
|
|
38
|
+
test=/usr/bin/false
|
|
39
|
+
verbose=/usr/bin/false
|
|
40
|
+
while getopts ag:htv argname; do
|
|
41
|
+
case ${argname} in
|
|
42
|
+
a) apacheACL="u:${apacheUID}:rX" ;;
|
|
43
|
+
g) desiGID=${OPTARG} ;;
|
|
44
|
+
h) usage; exit 0 ;;
|
|
45
|
+
t) test=/usr/bin/true; verbose=/usr/bin/true ;;
|
|
46
|
+
v) verbose=/usr/bin/true ;;
|
|
47
|
+
*) usage; exit 1 ;;
|
|
48
|
+
esac
|
|
49
|
+
done
|
|
50
|
+
shift $((OPTIND-1))
|
|
51
|
+
#
|
|
52
|
+
# Check for commands
|
|
53
|
+
#
|
|
54
|
+
find=/usr/bin/find
|
|
55
|
+
if [ ! -x "${find}" ]; then
|
|
56
|
+
echo "Could not find the 'find' command (tried ${find})!" >&2
|
|
57
|
+
exit 1
|
|
58
|
+
fi
|
|
59
|
+
setfacl=/usr/bin/setfacl
|
|
60
|
+
if [ ! -x "${setfacl}" ]; then
|
|
61
|
+
echo "Could not find the 'setfacl' command (tried ${setfacl})!" >&2
|
|
62
|
+
echo "Skipping all ACL changes." >&2
|
|
63
|
+
apacheACL=''
|
|
64
|
+
fi
|
|
65
|
+
#
|
|
66
|
+
# Make sure directory exists, and check consistency.
|
|
67
|
+
#
|
|
68
|
+
if [ $# -lt 1 ]; then
|
|
69
|
+
echo "You must specify a directory!" >&2
|
|
70
|
+
usage
|
|
71
|
+
exit 1
|
|
72
|
+
fi
|
|
73
|
+
directory=$1
|
|
74
|
+
if [ ! -d "${directory}" ]; then
|
|
75
|
+
echo "${directory} does not exist or is not a directory!" >&2
|
|
76
|
+
usage
|
|
77
|
+
exit 1
|
|
78
|
+
fi
|
|
79
|
+
if [ -z "${USER}" ]; then
|
|
80
|
+
echo "The USER environment variable does not appear to be set!" >&2
|
|
81
|
+
exit 1
|
|
82
|
+
fi
|
|
83
|
+
if [ -z "${NERSC_HOST}" ]; then
|
|
84
|
+
echo "Unable to determine NERSC environment. Are you running this script at NERSC?" >&2
|
|
85
|
+
exit 1
|
|
86
|
+
fi
|
|
87
|
+
if [ $(realpath ${directory}) = $(realpath ${HOME}) ]; then
|
|
88
|
+
echo "You are attempting to change the permissions of HOME=${HOME}, which is dangerous. Aborting." >&2
|
|
89
|
+
exit 1
|
|
90
|
+
fi
|
|
91
|
+
#
|
|
92
|
+
# Proceed with permission changes.
|
|
93
|
+
#
|
|
94
|
+
findbase="${find} ${directory} -user ${USER}"
|
|
95
|
+
${verbose} && echo "Fixing permissions on ${directory} ..."
|
|
96
|
+
if ${test}; then
|
|
97
|
+
run ${verbose} "${findbase} -not -group ${desiGID} -ls"
|
|
98
|
+
run ${verbose} "${findbase} -type f -not -perm /g+r -ls"
|
|
99
|
+
run ${verbose} "${findbase} -type d -not -perm -g+rxs -ls"
|
|
100
|
+
if [ -n "${apacheACL}" ]; then
|
|
101
|
+
run ${verbose} "${findbase} -exec ${setfacl} --test --modify ${apacheACL} {} ;"
|
|
102
|
+
fi
|
|
103
|
+
else
|
|
104
|
+
vflag=''
|
|
105
|
+
#
|
|
106
|
+
# Instruct chgrp & chmod to only report files that change.
|
|
107
|
+
#
|
|
108
|
+
${verbose} && vflag='-c'
|
|
109
|
+
# Change group.
|
|
110
|
+
run ${verbose} "${findbase} -not -group ${desiGID} -exec chgrp ${vflag} -h ${desiGID} {} ;"
|
|
111
|
+
# Set group read access.
|
|
112
|
+
run ${verbose} "${findbase} -type f -not -perm /g+r -exec chmod ${vflag} g+r {} ;"
|
|
113
|
+
run ${verbose} "${findbase} -type d -not -perm -g+rxs -exec chmod ${vflag} g+rxs {} ;"
|
|
114
|
+
if [ -n "${apacheACL}" ]; then
|
|
115
|
+
run ${verbose} "${findbase} -exec ${setfacl} --modify ${apacheACL} {} ;"
|
|
116
|
+
fi
|
|
117
|
+
fi
|
|
118
|
+
#
|
|
119
|
+
# Notes on searching for group-unreadable files.
|
|
120
|
+
#
|
|
121
|
+
# getfacl -R -t /global/cfs/cdirs//desi/spectro/ | grep -e '^# file:' -e '^GROUP' | sed -n 'h;n;G;p' | paste - - | awk '$3=="---" {print}'
|
|
122
|
+
#
|
|
123
|
+
# in a few minutes I didn't find any with "---" group ACL, but if I change to searching for things with a "r--" ACL, a sample of the output looks like:
|
|
124
|
+
# sleak@cori06$ getfacl -R -t /global/cfs/cdirs//desi/spectro/ | grep -e '^# file:' -e '^GROUP' | sed -n 'h;n;G;p' | paste - - | awk '$3=="r--" {print}' | head
|
|
125
|
+
# getfacl: Removing leading '/' from absolute path names
|
|
126
|
+
# GROUP desi r-- # file: global/cfs/cdirs//desi/spectro//ql_calib/fiberflat-z7.fits
|
|
127
|
+
# GROUP desi r-- # file: global/cfs/cdirs//desi/spectro//ql_calib/fiberflat-z3.fits
|
|
128
|
+
# GROUP desi r-- # file: global/cfs/cdirs//desi/spectro//ql_calib/fiberflat-b2.fits
|
|
129
|
+
# GROUP desi r-- # file: global/cfs/cdirs//desi/spectro//ql_calib/fiberflat-z4.fits
|
|
130
|
+
# GROUP desi r-- # file: global/cfs/cdirs//desi/spectro//ql_calib/fiberflat-b7.fits
|
|
131
|
+
# GROUP desi r-- # file: global/cfs/cdirs//desi/spectro//ql_calib/fiberflat-z6.fits
|
|
132
|
+
# GROUP desi r-- # file: global/cfs/cdirs//desi/spectro//ql_calib/fiberflat-b4.fits
|
|
133
|
+
# GROUP desi r-- # file: global/cfs/cdirs//desi/spectro//ql_calib/fiberflat-r7.fits
|
|
134
|
+
# GROUP desi r-- # file: global/cfs/cdirs//desi/spectro//ql_calib/fiberflat-b9.fits
|
|
135
|
+
# GROUP desi r-- # file: global/cfs/cdirs//desi/spectro//ql_calib/fiberflat-r0.fits
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Licensed under a 3-clause BSD style license - see LICENSE.rst
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
========
|
|
5
|
+
desiutil
|
|
6
|
+
========
|
|
7
|
+
|
|
8
|
+
This package provides low-level utilities for general use by DESI_.
|
|
9
|
+
|
|
10
|
+
.. _DESI: https://www.desi.lbl.gov
|
|
11
|
+
"""
|
|
12
|
+
#
|
|
13
|
+
# Set version string.
|
|
14
|
+
#
|
|
15
|
+
from ._version import __version__
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '3.5.0'
|