-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
10 changed files
with
198 additions
and
57 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
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,10 +1,11 @@ | ||
import asyncio | ||
import sys | ||
from .__init__ import __version__ | ||
|
||
print(f" *pygbag {__version__}*") | ||
|
||
from pathlib import Path | ||
from .app import main, main_run | ||
from .app import main_run | ||
|
||
if __name__ == "__main__": | ||
main_run(Path(sys.argv[-1]).resolve()) | ||
asyncio.run(main_run(Path(sys.argv[-1]).resolve())) |
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 |
---|---|---|
@@ -1,6 +1,41 @@ | ||
from pathlib import Path | ||
|
||
dbg = True | ||
|
||
|
||
def filter(*argv, **kw): | ||
pass | ||
def filter(walked): | ||
global dbg | ||
for folder, filenames in walked: | ||
blocking = False | ||
|
||
for block in ["/.git", "/.github", "/build", "/venv"]: | ||
if folder.match(block): | ||
if dbg: | ||
print("REJ 1", folder) | ||
blocking = True | ||
break | ||
|
||
fx = folder.as_posix() | ||
|
||
if fx.startswith(f"{block}/"): | ||
if dbg: | ||
print("REJ 2", folder) | ||
blocking = True | ||
break | ||
|
||
if blocking: | ||
continue | ||
|
||
for filename in filenames: | ||
if filename in [".gitignore"]: | ||
if dbg: | ||
print("REJ 3", folder, filename) | ||
continue | ||
|
||
ext = filename.rsplit(".", 1)[-1].lower() | ||
if ext in ["pyc", "pyx", "pyd", "pyi", "exe", "log"]: | ||
if dbg: | ||
print("REJ 4", folder, filename) | ||
continue | ||
|
||
yield Path(folder), Path(folder).joinpath(filename) |
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,16 +1,18 @@ | ||
from os import walk | ||
from pathlib import Path | ||
|
||
|
||
class Error(Exception): | ||
pass | ||
|
||
|
||
def gather(root:Path,*kw): | ||
def gather(root: Path, *kw): | ||
if root.is_file(): | ||
if root.name == "main.py": | ||
raise Error("project must be a folder or an archive") | ||
|
||
|
||
for current, dirnames, filenames in walk(root): | ||
print(current, len(dirnames), len(filenames)) | ||
yield | ||
rel = Path("/").joinpath(Path(current).relative_to(root)) | ||
|
||
# print(rel, len(dirnames), len(filenames)) | ||
yield rel, filenames |
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,2 +1,3 @@ | ||
def optimize(*argv, **kw): | ||
pass | ||
def optimize(filenames, **kw): | ||
for filename in filenames: | ||
yield filename |
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
Oops, something went wrong.