FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
emscripten/emar.py at incoming · JavaScriptIOT/emscripten · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
JavaScriptIOT
/
emscripten
Public
forked from
emscripten-core/emscripten
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
emscripten
/
emar.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
71 lines (61 loc) · 2 KB
Breadcrumbs
emscripten
/
emar.py
Copy path
File metadata and controls
executable file
·
71 lines (61 loc) · 2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python2
'''
emar - ar helper script
=======================
This script acts as a frontend replacement for ar. See emcc.
'''
from
__future__
import
print_function
from
tools
.
toolchain_profiler
import
ToolchainProfiler
if
__name__
==
'__main__'
:
ToolchainProfiler
.
record_process_start
()
import
os
,
subprocess
,
sys
from
tools
import
shared
#
# Main run() function
#
def
run
():
DEBUG
=
os
.
environ
.
get
(
'EMCC_DEBUG'
)
if
DEBUG
==
"0"
:
DEBUG
=
None
newargs
=
[
shared
.
LLVM_AR
]
+
sys
.
argv
[
1
:]
if
DEBUG
:
print
(
'emar:'
,
sys
.
argv
,
' ==> '
,
newargs
,
file
=
sys
.
stderr
)
to_delete
=
[]
if
len
(
newargs
)
>
2
:
if
'r'
in
newargs
[
1
]:
# we are adding files to the archive.
# find the .a; everything after it is an input file.
# we add a hash to each input, to make them unique as
# possible, as llvm-ar cannot extract duplicate names
# (and only the basename is used!)
i
=
1
while
i
<
len
(
newargs
):
if
newargs
[
i
].
endswith
(
'.a'
):
import
hashlib
,
shutil
for
j
in
range
(
i
+
1
,
len
(
newargs
)):
orig_name
=
newargs
[
j
]
full_name
=
os
.
path
.
abspath
(
orig_name
)
dir_name
=
os
.
path
.
dirname
(
full_name
)
base_name
=
os
.
path
.
basename
(
full_name
)
h
=
hashlib
.
md5
(
full_name
.
encode
(
'utf-8'
)).
hexdigest
()[:
8
]
parts
=
base_name
.
split
(
'.'
)
parts
[
0
]
+=
'_'
+
h
newname
=
'.'
.
join
(
parts
)
full_newname
=
os
.
path
.
join
(
dir_name
,
newname
)
if
not
os
.
path
.
exists
(
full_newname
):
try
:
# it is ok to fail here, we just don't get hashing
shutil
.
copyfile
(
orig_name
,
full_newname
)
newargs
[
j
]
=
full_newname
to_delete
.
append
(
full_newname
)
except
:
pass
break
i
+=
1
if
DEBUG
:
print
(
'Invoking '
+
str
(
newargs
))
subprocess
.
call
(
newargs
,
stdin
=
sys
.
stdin
)
for
d
in
to_delete
:
shared
.
try_delete
(
d
)
if
__name__
==
'__main__'
:
run
()
sys
.
exit
(
0
)
Back
|
FazBrowse Home
|
New Git URL