-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
76 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" | |
|
||
[project] | ||
name = "py416" | ||
version = "0.59" | ||
version = "0.60" | ||
authors = [ | ||
{ name="Ezio416", email="[email protected]" }, | ||
] | ||
|
@@ -26,3 +26,7 @@ dependencies = [ | |
[project.urls] | ||
"Homepage" = "https://github.com/ezio416/py416" | ||
"Bug Tracker" = "https://github.com/ezio416/py416/issues" | ||
|
||
[project.scripts] | ||
rmd = "py416.scripts:rmd" | ||
uzd = "py416.scripts:uzd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
clear_dist.py | ||
py -m build .. | ||
build_pkg | ||
twine upload ../dist/* | ||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
clear_dist.py | ||
py -m build .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@echo off | ||
REM run flake8 on py416.scripts | ||
REM E501 is the "line too long" error | ||
flake8 --extend-ignore=E501 ../src/py416/scripts.py | ||
set /p tmp="Press enter to exit" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
''' | ||
| Author: Ezio416 | ||
| Created: 2023-03-14 | ||
| Updated: 2023-03-14 | ||
- Functions behind console scripts | ||
- Call these functions directly by name from the command line | ||
''' | ||
import sys | ||
|
||
from .files import rmdir, unzipdir | ||
|
||
|
||
def rmd(): | ||
''' | ||
- recursively deletes empty directories | ||
- wraps `os.rmdir() <https://docs.python.org/3/library/os.html#os.rmdir>`_ | ||
Arguments | ||
--------- | ||
- none: delete empty folders where we are, but leave our parent intact | ||
- one argument: path to folder | ||
- folder in which to delete empty folders | ||
- two arguments: path to folder, anything | ||
- if a second value is present, we'll also try to delete the given folder | ||
- the second value itself is ignored | ||
''' | ||
if len(sys.argv) > 1: | ||
if len(sys.argv) > 2: | ||
print(f'deleted {rmdir(sys.argv[1])} empty folders') | ||
return | ||
print(f'deleted {rmdir(sys.argv[1], delroot=False)} empty folders') | ||
return | ||
print(f'deleted {rmdir(".", delroot=False)} empty folders') | ||
|
||
|
||
def uzd(): | ||
''' | ||
- unzips all archive files in a folder until it is unable to continue | ||
- recursive on archive files, but not folders | ||
- deletes all archive files as it unzips | ||
- supports archive files of type: (.7z, .gz, .rar, .tar, .zip) | ||
Arguments | ||
--------- | ||
- if any argument is passed, the script will stop upon error | ||
''' | ||
if len(sys.argv) > 1: | ||
print(f'unzipped {unzipdir(ignore_errors=False)} archive file(s)') | ||
return | ||
print(f'unzipped {unzipdir()} archive file(s)') |