Skip to content

Commit c685389

Browse files
Migrate Code Generation to Python3
1 parent 5bcc889 commit c685389

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

cf-java-logging-support-core/beats/scripts/generate_fields_docs.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
import yaml
44
import sys
@@ -75,19 +75,19 @@ def fields_to_asciidoc(input, output, beat):
7575

7676
# fields file is empty
7777
if docs is None:
78-
print "fields.yml file is empty. fields.asciidoc cannot be generated."
78+
print("fields.yml file is empty. fields.asciidoc cannot be generated.")
7979
return
8080

8181
# If no sections are defined, docs can't be generated
8282
if "sections" not in docs.keys():
83-
print "Sections is not defined in fields.yml. fields.asciidoc cannot be generated."
83+
print("Sections is not defined in fields.yml. fields.asciidoc cannot be generated.")
8484
return
8585

8686
sections = docs["sections"]
8787

8888
# Check if sections is define
8989
if sections is None:
90-
print "No sections are defined in fields.yml. fields.asciidoc cannot be generated."
90+
print("No sections are defined in fields.yml. fields.asciidoc cannot be generated.")
9191
return
9292

9393
for doc, _ in sections:
@@ -116,7 +116,7 @@ def fields_to_asciidoc(input, output, beat):
116116
if __name__ == "__main__":
117117

118118
if len(sys.argv) != 3:
119-
print "Usage: %s beatpath beatname" % sys.argv[0]
119+
print("Usage: %s beatpath beatname" % sys.argv[0])
120120
sys.exit(1)
121121

122122
beat_path = sys.argv[1]

cf-java-logging-support-core/beats/scripts/generate_template.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
"""
44
This script generates the ES template file ({beat}.template.json) from
@@ -26,7 +26,7 @@ def fields_to_es_template(input, output, index):
2626

2727
# No fields defined, can't generate template
2828
if docs is None:
29-
print "fields.yml is empty. Cannot generate template."
29+
print("fields.yml is empty. Cannot generate template.")
3030
return
3131

3232
# Remove sections as only needed for docs
@@ -35,7 +35,7 @@ def fields_to_es_template(input, output, index):
3535

3636
# Each template needs defaults
3737
if "defaults" not in docs.keys():
38-
print "No defaults are defined. Each template needs at least defaults defined."
38+
print("No defaults are defined. Each template needs at least defaults defined.")
3939
return
4040

4141
defaults = docs["defaults"]
@@ -202,7 +202,7 @@ def fill_field_properties(field, defaults):
202202
if __name__ == "__main__":
203203

204204
if len(sys.argv) != 3:
205-
print "Usage: %s beatpath beatname" % sys.argv[0]
205+
print("Usage: %s beatpath beatname" % sys.argv[0])
206206
sys.exit(1)
207207

208208
beat_path = sys.argv[1]

cf-java-logging-support-core/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<goal>exec</goal>
7070
</goals>
7171
<configuration>
72-
<executable>python</executable>
72+
<executable>python3</executable>
7373
<arguments>
7474
<argument>${basedir}/beats/scripts/generate_fields_docs.py</argument>
7575
<argument>${basedir}/beats/request-metrics</argument>
@@ -84,7 +84,7 @@
8484
<goal>exec</goal>
8585
</goals>
8686
<configuration>
87-
<executable>python</executable>
87+
<executable>python3</executable>
8888
<arguments>
8989
<argument>${basedir}/beats/scripts/generate_template.py</argument>
9090
<argument>${basedir}/beats/request-metrics</argument>
@@ -99,7 +99,7 @@
9999
<goal>exec</goal>
100100
</goals>
101101
<configuration>
102-
<executable>python</executable>
102+
<executable>python3</executable>
103103
<arguments>
104104
<argument>${basedir}/beats/scripts/generate_fields_docs.py</argument>
105105
<argument>${basedir}/beats/app-logs</argument>
@@ -114,7 +114,7 @@
114114
<goal>exec</goal>
115115
</goals>
116116
<configuration>
117-
<executable>python</executable>
117+
<executable>python3</executable>
118118
<arguments>
119119
<argument>${basedir}/beats/scripts/generate_template.py</argument>
120120
<argument>${basedir}/beats/app-logs</argument>

0 commit comments

Comments
 (0)