mirror of https://github.com/9001/r0c.git
squish
This commit is contained in:
parent
dba3430b31
commit
e264ca85bd
|
@ -0,0 +1,3 @@
|
|||
[submodule "scripts/corrupy"]
|
||||
path = scripts/corrupy
|
||||
url = git@github.com:CensoredUsername/corrupy.git
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 82ecacb1a81cdd726748a8fc2aa4b72f6d3a33a6
|
|
@ -150,12 +150,15 @@ unc="$HOME/dev/copyparty/scripts/uncomment.py"
|
|||
tr '\n' '\0' |
|
||||
xargs -0 $pybin $unc 1
|
||||
|
||||
echo
|
||||
echo minimizing files
|
||||
$pybin ../scripts/squish.py $(find site-packages/r0c -type f)
|
||||
|
||||
echo
|
||||
echo creating tar
|
||||
args=(--owner=1000 --group=1000)
|
||||
[ "$OSTYPE" = msys ] &&
|
||||
args=()
|
||||
|
||||
(for d in clients site-packages; do
|
||||
find $d -type f;
|
||||
done) |
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
|
||||
PY2 = sys.version_info < (3,)
|
||||
|
||||
from corrupy import minimize
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
raise ValueError("No command line arguments given. Expected one or more filenames")
|
||||
|
||||
for filename in sys.argv[1:]:
|
||||
print("minimizing {}".format(filename))
|
||||
|
||||
if PY2:
|
||||
with open(filename, "rb") as f:
|
||||
data = f.read()
|
||||
else:
|
||||
with open(filename, "r", encoding="utf-8") as f:
|
||||
data = f.read()
|
||||
|
||||
output = minimize.minimize(
|
||||
data,
|
||||
remove_docs=True, obfuscate_globals=False,
|
||||
obfuscate_builtins=False, obfuscate_imports=False
|
||||
)
|
||||
|
||||
if PY2:
|
||||
with open(filename, "wb") as f:
|
||||
f.write(output)
|
||||
else:
|
||||
with open(filename, "w", encoding="utf-8") as f:
|
||||
f.write(output)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Reference in New Issue