Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lib_base
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sikang
lib_base
Commits
9ad10cba
Commit
9ad10cba
authored
Oct 22, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
7cc48dac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
python/tools/garbel/package_garble.py
+7
-4
No files found.
python/tools/garbel/package_garble.py
View file @
9ad10cba
...
...
@@ -11,9 +11,9 @@ class PackageGarble:
# 随机串(全小写加下划线,避免和activity混淆重复)
def
__gen_rand_str
(
self
):
random_str1
=
''
.
join
(
random
.
sample
(
"abcdefghijklmnopqrstuvwxyz"
,
random
.
randint
(
4
,
8
)))
"abcdefghijklmnopqrstuvwxyz"
,
random
.
randint
(
3
,
6
)))
random_str2
=
''
.
join
(
random
.
sample
(
"abcdefghijklmnopqrstuvwxyz"
,
random
.
randint
(
4
,
8
)))
"abcdefghijklmnopqrstuvwxyz"
,
random
.
randint
(
3
,
6
)))
return
"
%
s_
%
s"
%
(
random_str1
,
random_str2
)
# 替换文件内容
...
...
@@ -73,6 +73,7 @@ class PackageGarble:
#重命名所有包路径
def
__rename_pkg
(
self
,
path
):
mapping
=
{}
for
root
,
dirs
,
files
in
os
.
walk
(
path
):
if
"main/java"
in
root
:
root
+=
"/"
...
...
@@ -85,10 +86,12 @@ class PackageGarble:
dir_name
=
value
.
split
(
"."
)[
index
]
old_name
=
os
.
path
.
join
(
os
.
path
.
join
(
os
.
getcwd
(),
root
),
dir
)
new_name
=
os
.
path
.
join
(
os
.
path
.
join
(
os
.
getcwd
(),
root
),
dir_name
)
os
.
rename
(
old_name
,
new_name
)
mapping
[
old_name
]
=
new_name
print
(
"rename
%
s ->
%
s"
%
(
dir
,
dir_name
))
break
for
(
old
,
new
)
in
mapping
.
items
:
os
.
rename
(
old
,
new
)
def
__process_files
(
self
,
path
):
for
root
,
dirs
,
files
in
os
.
walk
(
path
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment