admin-scripts 0.6.1__tar.gz → 0.6.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.
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/PKG-INFO +18 -3
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/README.md +3 -3
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/setup.py +25 -44
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/__init__.py +2 -11
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/base/__init__.py +2 -11
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/base/cleanup.py +74 -45
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/base/encoding.py +79 -63
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/base/join.py +60 -35
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/base/jssource.py +54 -38
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/base/misc.py +32 -23
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/base/pydev.py +69 -44
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/base/pysource.py +52 -38
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/base/stylesheets.py +188 -154
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/base/trailing_spaces.py +64 -44
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/config/__init__.py +2 -11
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/config/development/__init__.py +2 -11
- admin_scripts-0.6.3/src/admin_scripts/config/development/encoding.py +146 -0
- admin_scripts-0.6.1/src/admin_scripts/test/__init__.py → admin_scripts-0.6.3/src/admin_scripts/config/development/join.py +6 -10
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/config/development/jssource.py +3 -17
- admin_scripts-0.6.1/src/admin_scripts/config/development/pydev.py → admin_scripts-0.6.3/src/admin_scripts/config/development/misc.py +15 -14
- admin_scripts-0.6.1/src/admin_scripts/config/development/join.py → admin_scripts-0.6.3/src/admin_scripts/config/development/pydev.py +3 -17
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/config/development/pysource.py +6 -15
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/config/development/stylesheets.py +10 -23
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/config/development/trailing_spaces.py +17 -35
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/extra/__init__.py +2 -11
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/extra/css.py +10 -14
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/extra/js.py +31 -27
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/extra/lib.py +11 -14
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/extra/log.py +11 -12
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/extra/shell.py +11 -16
- admin_scripts-0.6.3/src/admin_scripts/test/__init__.py +26 -0
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/test/css.py +3 -11
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/test/stylesheets.py +18 -29
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts.egg-info/PKG-INFO +18 -3
- admin_scripts-0.6.1/src/admin_scripts/config/development/encoding.py +0 -182
- admin_scripts-0.6.1/src/admin_scripts/config/development/misc.py +0 -55
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/setup.cfg +0 -0
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts/config/extra/jshint.json +0 -0
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts.egg-info/SOURCES.txt +0 -0
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts.egg-info/dependency_links.txt +0 -0
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts.egg-info/entry_points.txt +0 -0
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts.egg-info/not-zip-safe +0 -0
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts.egg-info/requires.txt +0 -0
- {admin_scripts-0.6.1 → admin_scripts-0.6.3}/src/admin_scripts.egg-info/top_level.txt +0 -0
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
Metadata-Version:
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: admin_scripts
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.3
|
|
4
4
|
Summary: Administration Scripts
|
|
5
5
|
Home-page: http://admin-scripts.hive.pt
|
|
6
6
|
Author: Hive Solutions Lda.
|
|
7
7
|
Author-email: development@hive.pt
|
|
8
8
|
License: Apache License, Version 2.0
|
|
9
|
-
Description:
|
|
9
|
+
Description: # [Admin Scripts](http://admin-scripts.hive.pt)
|
|
10
|
+
|
|
11
|
+
Set of scripts for general administration tasks.
|
|
12
|
+
|
|
13
|
+
## License
|
|
14
|
+
|
|
15
|
+
Admin Scripts is currently licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/).
|
|
16
|
+
|
|
17
|
+
## Build Automation
|
|
18
|
+
|
|
19
|
+
[](https://travis-ci.com/github/hivesolutions/admin-scripts)
|
|
20
|
+
[](https://coveralls.io/r/hivesolutions/admin-scripts?branch=master)
|
|
21
|
+
[](https://pypi.python.org/pypi/admin-scripts)
|
|
22
|
+
[](https://www.apache.org/licenses/)
|
|
23
|
+
|
|
10
24
|
Keywords: scripts admin public
|
|
11
25
|
Platform: UNKNOWN
|
|
12
26
|
Classifier: Development Status :: 5 - Production/Stable
|
|
@@ -24,3 +38,4 @@ Classifier: Programming Language :: Python :: 3.4
|
|
|
24
38
|
Classifier: Programming Language :: Python :: 3.5
|
|
25
39
|
Classifier: Programming Language :: Python :: 3.6
|
|
26
40
|
Classifier: Programming Language :: Python :: 3.7
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
@@ -8,7 +8,7 @@ Admin Scripts is currently licensed under the [Apache License, Version 2.0](http
|
|
|
8
8
|
|
|
9
9
|
## Build Automation
|
|
10
10
|
|
|
11
|
-
[](https://travis-ci.com/github/hivesolutions/admin-scripts)
|
|
12
|
+
[](https://coveralls.io/r/hivesolutions/admin-scripts?branch=master)
|
|
13
|
+
[](https://pypi.python.org/pypi/admin-scripts)
|
|
14
14
|
[](https://www.apache.org/licenses/)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
# Hive Administration Scripts
|
|
5
|
-
# Copyright (c) 2008-
|
|
5
|
+
# Copyright (c) 2008-2025 Hive Solutions Lda.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of Hive Administration Scripts.
|
|
8
8
|
#
|
|
@@ -22,16 +22,7 @@
|
|
|
22
22
|
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
23
|
""" The author(s) of the module """
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
""" The version of the module """
|
|
27
|
-
|
|
28
|
-
__revision__ = "$LastChangedRevision$"
|
|
29
|
-
""" The revision number of the module """
|
|
30
|
-
|
|
31
|
-
__date__ = "$LastChangedDate$"
|
|
32
|
-
""" The last change date of the module """
|
|
33
|
-
|
|
34
|
-
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda."
|
|
25
|
+
__copyright__ = "Copyright (c) 2008-2025 Hive Solutions Lda."
|
|
35
26
|
""" The copyright for the module """
|
|
36
27
|
|
|
37
28
|
__license__ = "Apache License, Version 2.0"
|
|
@@ -41,43 +32,29 @@ import os
|
|
|
41
32
|
import setuptools
|
|
42
33
|
|
|
43
34
|
setuptools.setup(
|
|
44
|
-
name
|
|
45
|
-
version
|
|
46
|
-
author
|
|
47
|
-
author_email
|
|
48
|
-
description
|
|
49
|
-
license
|
|
50
|
-
keywords
|
|
51
|
-
url
|
|
52
|
-
zip_safe
|
|
53
|
-
packages
|
|
35
|
+
name="admin_scripts",
|
|
36
|
+
version="0.6.3",
|
|
37
|
+
author="Hive Solutions Lda.",
|
|
38
|
+
author_email="development@hive.pt",
|
|
39
|
+
description="Administration Scripts",
|
|
40
|
+
license="Apache License, Version 2.0",
|
|
41
|
+
keywords="scripts admin public",
|
|
42
|
+
url="http://admin-scripts.hive.pt",
|
|
43
|
+
zip_safe=False,
|
|
44
|
+
packages=[
|
|
54
45
|
"admin_scripts",
|
|
55
46
|
"admin_scripts.base",
|
|
56
47
|
"admin_scripts.config",
|
|
57
48
|
"admin_scripts.config.development",
|
|
58
49
|
"admin_scripts.extra",
|
|
59
|
-
"admin_scripts.test"
|
|
50
|
+
"admin_scripts.test",
|
|
60
51
|
],
|
|
61
|
-
test_suite
|
|
62
|
-
package_dir
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"config/extra/*"
|
|
68
|
-
]
|
|
69
|
-
},
|
|
70
|
-
entry_points = {
|
|
71
|
-
"console_scripts" : [
|
|
72
|
-
"cleanup = admin_scripts.base.cleanup:run"
|
|
73
|
-
]
|
|
74
|
-
},
|
|
75
|
-
install_requires = [
|
|
76
|
-
"legacy",
|
|
77
|
-
"pep8",
|
|
78
|
-
"jsbeautifier"
|
|
79
|
-
],
|
|
80
|
-
classifiers = [
|
|
52
|
+
test_suite="admin_scripts.test",
|
|
53
|
+
package_dir={"": os.path.normpath("src")},
|
|
54
|
+
package_data={"admin_scripts": ["config/extra/*"]},
|
|
55
|
+
entry_points={"console_scripts": ["cleanup = admin_scripts.base.cleanup:run"]},
|
|
56
|
+
install_requires=["legacy", "pep8", "jsbeautifier"],
|
|
57
|
+
classifiers=[
|
|
81
58
|
"Development Status :: 5 - Production/Stable",
|
|
82
59
|
"Topic :: Utilities",
|
|
83
60
|
"License :: OSI Approved :: Apache Software License",
|
|
@@ -92,6 +69,10 @@ setuptools.setup(
|
|
|
92
69
|
"Programming Language :: Python :: 3.4",
|
|
93
70
|
"Programming Language :: Python :: 3.5",
|
|
94
71
|
"Programming Language :: Python :: 3.6",
|
|
95
|
-
"Programming Language :: Python :: 3.7"
|
|
96
|
-
]
|
|
72
|
+
"Programming Language :: Python :: 3.7",
|
|
73
|
+
],
|
|
74
|
+
long_description=open(os.path.join(os.path.dirname(__file__), "README.md"), "rb")
|
|
75
|
+
.read()
|
|
76
|
+
.decode("utf-8"),
|
|
77
|
+
long_description_content_type="text/markdown",
|
|
97
78
|
)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
# Hive Administration Scripts
|
|
5
|
-
# Copyright (c) 2008-
|
|
5
|
+
# Copyright (c) 2008-2025 Hive Solutions Lda.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of Hive Administration Scripts.
|
|
8
8
|
#
|
|
@@ -19,16 +19,7 @@
|
|
|
19
19
|
# You should have received a copy of the Apache License along with
|
|
20
20
|
# Hive Administration Scripts. If not, see <http://www.apache.org/licenses/>.
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
""" The version of the module """
|
|
24
|
-
|
|
25
|
-
__revision__ = "$LastChangedRevision$"
|
|
26
|
-
""" The revision number of the module """
|
|
27
|
-
|
|
28
|
-
__date__ = "$LastChangedDate$"
|
|
29
|
-
""" The last change date of the module """
|
|
30
|
-
|
|
31
|
-
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda."
|
|
22
|
+
__copyright__ = "Copyright (c) 2008-2025 Hive Solutions Lda."
|
|
32
23
|
""" The copyright for the module """
|
|
33
24
|
|
|
34
25
|
__license__ = "Apache License, Version 2.0"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
# Hive Administration Scripts
|
|
5
|
-
# Copyright (c) 2008-
|
|
5
|
+
# Copyright (c) 2008-2025 Hive Solutions Lda.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of Hive Administration Scripts.
|
|
8
8
|
#
|
|
@@ -19,16 +19,7 @@
|
|
|
19
19
|
# You should have received a copy of the Apache License along with
|
|
20
20
|
# Hive Administration Scripts. If not, see <http://www.apache.org/licenses/>.
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
""" The version of the module """
|
|
24
|
-
|
|
25
|
-
__revision__ = "$LastChangedRevision$"
|
|
26
|
-
""" The revision number of the module """
|
|
27
|
-
|
|
28
|
-
__date__ = "$LastChangedDate$"
|
|
29
|
-
""" The last change date of the module """
|
|
30
|
-
|
|
31
|
-
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda."
|
|
22
|
+
__copyright__ = "Copyright (c) 2008-2025 Hive Solutions Lda."
|
|
32
23
|
""" The copyright for the module """
|
|
33
24
|
|
|
34
25
|
__license__ = "Apache License, Version 2.0"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
# Hive Administration Scripts
|
|
5
|
-
# Copyright (c) 2008-
|
|
5
|
+
# Copyright (c) 2008-2025 Hive Solutions Lda.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of Hive Administration Scripts.
|
|
8
8
|
#
|
|
@@ -22,16 +22,7 @@
|
|
|
22
22
|
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
23
|
""" The author(s) of the module """
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
""" The version of the module """
|
|
27
|
-
|
|
28
|
-
__revision__ = "$LastChangedRevision$"
|
|
29
|
-
""" The revision number of the module """
|
|
30
|
-
|
|
31
|
-
__date__ = "$LastChangedDate$"
|
|
32
|
-
""" The last change date of the module """
|
|
33
|
-
|
|
34
|
-
__copyright__ = "Copyright (c) 2008-2020 Hive Solutions Lda."
|
|
25
|
+
__copyright__ = "Copyright (c) 2008-2025 Hive Solutions Lda."
|
|
35
26
|
""" The copyright for the module """
|
|
36
27
|
|
|
37
28
|
__license__ = "Apache License, Version 2.0"
|
|
@@ -56,21 +47,21 @@ SCRIPTS_LIST = [
|
|
|
56
47
|
"pysource.py",
|
|
57
48
|
"jssource.py",
|
|
58
49
|
"trailing_spaces.py",
|
|
59
|
-
"misc.py"
|
|
50
|
+
"misc.py",
|
|
60
51
|
]
|
|
61
52
|
""" The list of scripts to be executed by the complete
|
|
62
53
|
cleanup operation, each of the scripts will be executed
|
|
63
54
|
as a separate process in a chained process """
|
|
64
55
|
|
|
65
56
|
SCRIPTS_CONFIGURATION_MAP = {
|
|
66
|
-
"stylesheets.py"
|
|
67
|
-
"encoding.py"
|
|
68
|
-
"join.py"
|
|
69
|
-
"pydev.py"
|
|
70
|
-
"pysource.py"
|
|
71
|
-
"jssource.py"
|
|
72
|
-
"trailing_spaces.py"
|
|
73
|
-
"misc.py"
|
|
57
|
+
"stylesheets.py": "development/stylesheets.py",
|
|
58
|
+
"encoding.py": "development/encoding.py",
|
|
59
|
+
"join.py": "development/join.py",
|
|
60
|
+
"pydev.py": "development/pydev.py",
|
|
61
|
+
"pysource.py": "development/pysource.py",
|
|
62
|
+
"jssource.py": "development/jssource.py",
|
|
63
|
+
"trailing_spaces.py": "development/trailing_spaces.py",
|
|
64
|
+
"misc.py": "development/misc.py",
|
|
74
65
|
}
|
|
75
66
|
""" The map associating the script name with the name
|
|
76
67
|
of the configuration file, so that during execution
|
|
@@ -79,8 +70,8 @@ the proper values are passed to each script """
|
|
|
79
70
|
CONFIGURATION_RELATIVE_PATH = "../config/"
|
|
80
71
|
""" The relative path to the configuration directory """
|
|
81
72
|
|
|
82
|
-
|
|
83
|
-
""" The python (execution)
|
|
73
|
+
PYTHON_COMMANDS = ("python", "python3")
|
|
74
|
+
""" The python (execution) commands that are going to
|
|
84
75
|
be run in the execution shell (should be globally accessible) """
|
|
85
76
|
|
|
86
77
|
CONFIGURATION_FLAG = "-c"
|
|
@@ -91,6 +82,7 @@ WINDOWS_PLATFORMS = ("nt", "ce", "dos")
|
|
|
91
82
|
series of constant values corresponding to the complete
|
|
92
83
|
valid platform values for windows """
|
|
93
84
|
|
|
85
|
+
|
|
94
86
|
def run():
|
|
95
87
|
# retrieves the path to the "current" directory
|
|
96
88
|
directory_path = os.path.dirname(__file__)
|
|
@@ -131,15 +123,23 @@ def run():
|
|
|
131
123
|
# creates both the script and the configuration paths
|
|
132
124
|
# note that there's a path normalization process
|
|
133
125
|
script_path = os.path.join(directory_path, script)
|
|
134
|
-
configuration_path =
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
126
|
+
configuration_path = (
|
|
127
|
+
os.path.join(
|
|
128
|
+
directory_path,
|
|
129
|
+
os.path.join(
|
|
130
|
+
CONFIGURATION_RELATIVE_PATH, script_configuration_file_name
|
|
131
|
+
),
|
|
132
|
+
)
|
|
133
|
+
if script_configuration_file_name
|
|
134
|
+
else None
|
|
135
|
+
)
|
|
138
136
|
|
|
139
137
|
# resolves both paths as absolute so that the proper value
|
|
140
138
|
# is passed to the underlying command line execution
|
|
141
|
-
if not script_path == None:
|
|
142
|
-
|
|
139
|
+
if not script_path == None:
|
|
140
|
+
script_path = os.path.abspath(script_path)
|
|
141
|
+
if not configuration_path == None:
|
|
142
|
+
configuration_path = os.path.abspath(configuration_path)
|
|
143
143
|
|
|
144
144
|
# creates the arguments list from the various
|
|
145
145
|
# processed arguments
|
|
@@ -152,46 +152,70 @@ def run():
|
|
|
152
152
|
arguments.extend(extra_arguments)
|
|
153
153
|
|
|
154
154
|
# prints a message and flushes the standard output
|
|
155
|
-
extra.echo(
|
|
155
|
+
extra.echo(
|
|
156
|
+
"------------------------------------------------------------------------"
|
|
157
|
+
)
|
|
156
158
|
extra.echo("Executing script file: %s" % script)
|
|
157
|
-
extra.echo(
|
|
159
|
+
extra.echo(
|
|
160
|
+
"------------------------------------------------------------------------"
|
|
161
|
+
)
|
|
158
162
|
sys.stdout.flush()
|
|
159
163
|
|
|
160
164
|
# opens a sub-process for script execution (and waits for the end of it)
|
|
161
165
|
process = subprocess.Popen(
|
|
162
166
|
arguments,
|
|
163
|
-
stdin
|
|
164
|
-
stdout
|
|
165
|
-
stderr
|
|
166
|
-
shell
|
|
167
|
+
stdin=sys.stdin,
|
|
168
|
+
stdout=sys.stdout,
|
|
169
|
+
stderr=sys.stderr,
|
|
170
|
+
shell=shell_value,
|
|
167
171
|
)
|
|
168
172
|
process.wait()
|
|
169
173
|
sys.stdout.flush()
|
|
170
174
|
|
|
171
175
|
# in case the return code of the process is not the expected one (zero)
|
|
172
176
|
# the final exit code to be returned by the process is changed to error
|
|
173
|
-
if not process.returncode == 0:
|
|
177
|
+
if not process.returncode == 0:
|
|
178
|
+
exit_code = 1
|
|
174
179
|
|
|
175
180
|
# creates the proper prefix message using the return code from the process
|
|
176
181
|
# note that the failed prefix is set for unwanted error codes
|
|
177
182
|
prefix = "Finished" if process.returncode == 0 else "Finished (with errors)"
|
|
178
183
|
|
|
179
184
|
# print a message and flushes the standard output
|
|
180
|
-
extra.echo(
|
|
185
|
+
extra.echo(
|
|
186
|
+
"------------------------------------------------------------------------"
|
|
187
|
+
)
|
|
181
188
|
extra.echo("%s executing script file: %s" % (prefix, script))
|
|
182
|
-
extra.echo(
|
|
189
|
+
extra.echo(
|
|
190
|
+
"------------------------------------------------------------------------"
|
|
191
|
+
)
|
|
183
192
|
sys.stdout.flush()
|
|
184
193
|
|
|
185
194
|
# exits the current process with the code that has been calculated
|
|
186
195
|
# from the execution of the various sub-scripts
|
|
187
196
|
sys.exit(exit_code)
|
|
188
197
|
|
|
198
|
+
|
|
189
199
|
def config(target_path):
|
|
200
|
+
executable = None
|
|
201
|
+
|
|
202
|
+
for command in PYTHON_COMMANDS:
|
|
203
|
+
for path_dir in os.environ.get("PATH", "").split(os.pathsep):
|
|
204
|
+
full_path = os.path.join(path_dir, command)
|
|
205
|
+
if os.path.isfile(full_path) and os.access(full_path, os.X_OK):
|
|
206
|
+
executable = full_path
|
|
207
|
+
break
|
|
208
|
+
if executable:
|
|
209
|
+
break
|
|
210
|
+
|
|
211
|
+
if not executable:
|
|
212
|
+
raise Exception("No python executable found")
|
|
213
|
+
|
|
190
214
|
config = dict(
|
|
191
|
-
scripts
|
|
192
|
-
disabled
|
|
193
|
-
configuration
|
|
194
|
-
command
|
|
215
|
+
scripts=list(SCRIPTS_LIST),
|
|
216
|
+
disabled=[],
|
|
217
|
+
configuration=dict(SCRIPTS_CONFIGURATION_MAP),
|
|
218
|
+
command=executable,
|
|
195
219
|
)
|
|
196
220
|
|
|
197
221
|
home_path = "~/.cleanup.json"
|
|
@@ -212,11 +236,14 @@ def config(target_path):
|
|
|
212
236
|
paths = (home_path, base_path, current_path)
|
|
213
237
|
|
|
214
238
|
for path in paths:
|
|
215
|
-
if not os.path.exists(path):
|
|
239
|
+
if not os.path.exists(path):
|
|
240
|
+
continue
|
|
216
241
|
|
|
217
242
|
file = open(path, "rb")
|
|
218
|
-
try:
|
|
219
|
-
|
|
243
|
+
try:
|
|
244
|
+
data = file.read()
|
|
245
|
+
finally:
|
|
246
|
+
file.close()
|
|
220
247
|
data = data.decode("utf-8")
|
|
221
248
|
data_j = json.loads(data)
|
|
222
249
|
|
|
@@ -227,11 +254,13 @@ def config(target_path):
|
|
|
227
254
|
disabled += config.get("excluded", [])
|
|
228
255
|
|
|
229
256
|
for name in disabled:
|
|
230
|
-
if not name in scripts:
|
|
257
|
+
if not name in scripts:
|
|
258
|
+
continue
|
|
231
259
|
scripts.remove(name)
|
|
232
260
|
|
|
233
261
|
return config
|
|
234
262
|
|
|
263
|
+
|
|
235
264
|
if __name__ == "__main__":
|
|
236
265
|
run()
|
|
237
266
|
else:
|