Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lukas Niegsch
slapos
Commits
ede3f1a1
Commit
ede3f1a1
authored
Dec 12, 2021
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
format-json: python3 support
parent
5442c76f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
format-json
format-json
+5
-5
No files found.
format-json
View file @
ede3f1a1
...
@@ -10,7 +10,7 @@ Usage::
...
@@ -10,7 +10,7 @@ Usage::
"""
"""
import
os
from
__future__
import
print_function
import
sys
import
sys
import
json
import
json
import
collections
import
collections
...
@@ -19,15 +19,15 @@ import collections
...
@@ -19,15 +19,15 @@ import collections
def
main
():
def
main
():
exit_code
=
0
exit_code
=
0
for
f
in
sys
.
argv
[
1
:]:
for
f
in
sys
.
argv
[
1
:]:
print
'Processing %s'
%
(
f
,)
print
(
'Processing'
,
f
,)
with
open
(
f
,
'rb'
)
as
infile
:
with
open
(
f
)
as
infile
:
try
:
try
:
obj
=
json
.
load
(
infile
,
object_pairs_hook
=
collections
.
OrderedDict
)
obj
=
json
.
load
(
infile
,
object_pairs_hook
=
collections
.
OrderedDict
)
except
ValueError
as
e
:
except
ValueError
as
e
:
exit_code
=
1
exit_code
=
1
print
e
print
(
e
,
file
=
sys
.
stderr
)
else
:
else
:
with
open
(
f
,
'w
b
'
)
as
outfile
:
with
open
(
f
,
'w'
)
as
outfile
:
json
.
dump
(
obj
,
outfile
,
sort_keys
=
False
,
indent
=
2
,
separators
=
(
','
,
': '
))
json
.
dump
(
obj
,
outfile
,
sort_keys
=
False
,
indent
=
2
,
separators
=
(
','
,
': '
))
outfile
.
write
(
'
\
n
'
)
outfile
.
write
(
'
\
n
'
)
sys
.
exit
(
exit_code
)
sys
.
exit
(
exit_code
)
...
...
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