walker 0.1.0__py3-none-any.whl

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.
walker/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ __author__ = 'D. Yu'
2
+ __email__ = 'dyu+honeypot@fastmail.fm'
3
+ __version__ = '0.1.0'
walker/main.py ADDED
@@ -0,0 +1,33 @@
1
+ import os
2
+ import subprocess
3
+ import sys
4
+
5
+
6
+ def execute_command(target):
7
+ os.chdir(target)
8
+ command = sys.argv[1:]
9
+ try:
10
+ subprocess.check_call(command)
11
+ except Exception as e:
12
+ print(f"ERROR in {target}: {e}")
13
+
14
+
15
+ def main():
16
+ base = os.getcwd() + "/"
17
+ targets = None
18
+
19
+ # Get immediate child directories.
20
+ for _root, dirs, _files in os.walk('.'):
21
+ targets = dirs
22
+ break # dirty hack so we only get the first level
23
+
24
+ # Traverse through the directories.
25
+ for target in sorted(targets, key=lambda s: s.lower()):
26
+ target_full_path = base + target
27
+ print(f"\nwalker: in {target_full_path}", flush=True)
28
+ execute_command(target_full_path)
29
+ os.chdir(base)
30
+
31
+
32
+ if __name__ == '__main__':
33
+ main()
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.5
2
+ Name: walker
3
+ Version: 0.1.0
4
+ Summary: Walker executes the same command on multiple directories.
5
+ Project-URL: Homepage, https://github.com/darylyu/walker
6
+ Project-URL: Documentation, https://walker.readthedocs.org
7
+ Project-URL: Issues, https://github.com/darylyu/walker/issues
8
+ Project-URL: Changelog, https://github.com/darylyu/walker/blob/master/HISTORY.rst
9
+ Author-email: "D. Yu" <dyu+honeypot@fastmail.fm>
10
+ License-Expression: BSD-3-Clause
11
+ License-File: LICENSE
12
+ Keywords: walker
13
+ Classifier: Development Status :: 2 - Pre-Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Natural Language :: English
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/x-rst
24
+
25
+ ===============================
26
+ walker
27
+ ===============================
28
+
29
+ .. image:: https://img.shields.io/pypi/v/walker.svg
30
+ :target: https://pypi.org/project/walker/
31
+
32
+ .. image:: https://github.com/darylyu/walker/actions/workflows/ci.yml/badge.svg
33
+ :target: https://github.com/darylyu/walker/actions/workflows/ci.yml
34
+
35
+
36
+ Walker executes the same command on multiple directories.
37
+
38
+ * Free software: BSD license
39
+ * Documentation: https://walker.readthedocs.org.
40
+
41
+ Installation
42
+ ---------------
43
+
44
+ Walker needs Python 3.11 or newer. It can be installed from PyPI. ::
45
+
46
+ $ pip install walker
47
+
48
+ Or, to install it as a standalone command-line tool::
49
+
50
+ $ pipx install walker # or: uv tool install walker
51
+
52
+ Usage
53
+ --------
54
+
55
+ Walker only gets the immediate children of the current directory.
56
+
57
+ Here is an example of it showing showing the status of different
58
+ git repositories: ::
59
+
60
+ $ walker git status
61
+
62
+ walker: in /home/dyu/src/couchdb-lucene
63
+ # On branch master
64
+ nothing to commit (working directory clean)
65
+
66
+ walker: in /home/dyu/src/dotfiles
67
+ # On branch master
68
+ # Changes not staged for commit:
69
+ # (use "git add <file>..." to update what will be committed)
70
+ # (use "git checkout -- <file>..." to discard changes in working directory)
71
+ #
72
+ # modified: gitignore_global
73
+ #
74
+ no changes added to commit (use "git add" and/or "git commit -a")
75
+
76
+ walker: in /home/dyu/src/es
77
+ fatal: Not a git repository (or any of the parent directories): .git
78
+
79
+ Here is another example of it showing disk usage: ::
80
+
81
+ $ walker du -cksh
82
+
83
+ walker: in /home/dyu/src/cookiecutter
84
+ 2.1M .
85
+ 2.1M total
86
+
87
+ walker: in /home/dyu/src/couchdb-lucene
88
+ 145M .
89
+ 145M total
90
+
91
+ walker: in /home/dyu/src/dotfiles
92
+ 588K .
93
+ 588K total
94
+
95
+ walker: in /home/dyu/src/es
96
+ 245M .
97
+ 245M total
@@ -0,0 +1,7 @@
1
+ walker/__init__.py,sha256=YZEXnIMy_4N0hPz-MLHILQbGMBgVEbqblXw_9-ARzvo,82
2
+ walker/main.py,sha256=AjS7RJ4kYWTtTrK2NakkfpKTXrJZRaFsqy-Cf6VnbjY,772
3
+ walker-0.1.0.dist-info/METADATA,sha256=g0Ppz2Zb6GaoHL1lOK_7OkHM-dFMwfytbjxzezOff2g,2866
4
+ walker-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
5
+ walker-0.1.0.dist-info/entry_points.txt,sha256=_nqkdIF3lt4rIr0Neujfx7digZ7W3TIwAiQjOJ2e5uc,44
6
+ walker-0.1.0.dist-info/licenses/LICENSE,sha256=XddthT08EliqI3vWkeR4_Ycr6uE7Yd3gkbbEOyL-bGM,1458
7
+ walker-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ walker = walker.main:main
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2014, D. Yu
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+
8
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
+
10
+ * Neither the name of walker nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.