]> git.ipfire.org Git - thirdparty/suricata-update.git/commitdiff
python 3 fixups
authorJason Ish <ish@unx.ca>
Wed, 6 Dec 2017 18:59:37 +0000 (12:59 -0600)
committerJason Ish <ish@unx.ca>
Wed, 6 Dec 2017 20:11:13 +0000 (14:11 -0600)
- enable-source
- update-sources
- setup.py

setup.py
suricata/update/commands/enablesource.py
suricata/update/commands/updatesources.py
suricata/update/sources.py

index 351f2bb4e0baaf0ce1a5105a6ca5c3efde914071..99dec9a6dbdf982be207cc63a03eaafae1f9079f 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -8,7 +8,7 @@ def write_revision():
         revision = subprocess.check_output(
             ["git", "rev-parse", "--short", "HEAD"])
         with open("./suricata/update/revision.py", "w") as fileobj:
-            fileobj.write("revision = '%s'" % (revision.strip()))
+            fileobj.write("revision = '%s'" % (revision.decode().strip()))
     except Exception as err:
         print("Failed to get current git revision: %s" % (err))
 
index aa1113cfc3aa3a8446011eb42c52d53ff63b6a1f..747edeb4d4d544f6111090d41913eb3280a2ed63 100644 (file)
@@ -134,6 +134,6 @@ def write_source_config(config, enabled):
         filename = sources.get_enabled_source_filename(config.name)
     else:
         filename = sources.get_disabled_source_filename(config.name)
-    with open(filename, "wb") as fileobj:
+    with open(filename, "w") as fileobj:
         logger.debug("Writing %s", filename)
         fileobj.write(yaml.safe_dump(config.dict(), default_flow_style=False))
index 0e6c9847bc78c523bea8e7ec37dfe8870e920136..1ec8e163886cd7437d77809321d4117abe864482 100644 (file)
@@ -44,6 +44,6 @@ def update_sources(config):
                 logger.error("Failed to create directory %s: %s",
                              config.get_cache_dir(), err)
                 return 1
-        with open(local_index_filename, "w") as outobj:
+        with open(local_index_filename, "wb") as outobj:
             outobj.write(fileobj.getvalue())
         logger.info("Saved %s", local_index_filename)
index f1e314697f151cc29919b4a58c1f67824cc32524..7bb82519092bc3137034600a5110da24d529896d 100644 (file)
@@ -68,7 +68,7 @@ def get_source_index_url(config):
     return DEFAULT_SOURCE_INDEX_URL
 
 def save_source_config(source_config):
-    with open(get_enabled_source_filename(source_config.name), "wb") as fileobj:
+    with open(get_enabled_source_filename(source_config.name), "w") as fileobj:
         fileobj.write(yaml.safe_dump(
             source_config.dict(), default_flow_style=False))