Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4793332
install-clang-format-alias.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
install-clang-format-alias.py
View Options
#!/usr/bin/env python3
# -------------------------------------------------------------
# Create clang-format
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Description: Search for clang-format<version> and alias it
# License: BSD-2-Clause
# -------------------------------------------------------------
from
glob
import
glob
import
os
import
sys
# -------------------------------------------------------------
# Create clang-format alias
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def
create_alias
(
bin_directory
):
candidates
=
glob
(
f
"{bin_directory}/clang-format*"
)
if
not
candidates
:
return
False
candidate
=
max
(
candidates
)
os
.
symlink
(
candidate
,
f
"{bin_directory}/clang-format"
)
return
True
# -------------------------------------------------------------
# Application entry point
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if
__name__
==
"__main__"
:
argc
=
len
(
sys
.
argv
)
if
argc
<
2
:
print
(
f
"Usage: {sys.argv[0]} <bin directory>"
,
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
create_alias
(
sys
.
argv
[
1
])
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Fri, Feb 28, 21:45 (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2436173
Default Alt Text
install-clang-format-alias.py (1 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment