summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gemato/cli.py5
-rw-r--r--gemato/compression.py4
-rw-r--r--gemato/hash.py2
-rw-r--r--gemato/verify.py3
-rwxr-xr-xutils/gen-test-manifest.py7
-rwxr-xr-xutils/gen_fast_manifest.py9
-rwxr-xr-xutils/gen_fast_metamanifest.py12
7 files changed, 19 insertions, 23 deletions
diff --git a/gemato/cli.py b/gemato/cli.py
index 08d908a..a831344 100644
--- a/gemato/cli.py
+++ b/gemato/cli.py
@@ -7,7 +7,6 @@ from __future__ import print_function
import argparse
import datetime
-import io
import logging
import multiprocessing
import os.path
@@ -113,7 +112,7 @@ class BaseOpenPGPMixin(object):
proxy=args.proxy)
if args.openpgp_key is not None:
- with io.open(args.openpgp_key, 'rb') as f:
+ with open(args.openpgp_key, 'rb') as f:
self.openpgp_env.import_key(f)
def cleanup(self):
@@ -539,7 +538,7 @@ class OpenPGPVerifyCommand(VerifyingOpenPGPMixin, GematoCommand):
if p == '-':
f = sys.stdin
else:
- f = io.open(p, 'r')
+ f = open(p, 'r')
try:
try:
diff --git a/gemato/compression.py b/gemato/compression.py
index e573153..6fd0ef2 100644
--- a/gemato/compression.py
+++ b/gemato/compression.py
@@ -75,13 +75,13 @@ def open_potentially_compressed_path(path, mode, **kwargs):
compression = get_compressed_suffix_from_filename(path)
if compression is None:
- return io.open(path, mode, **kwargs)
+ return open(path, mode, **kwargs)
bmode = mode
if 'b' not in bmode:
bmode += 'b'
- f = io.open(path, bmode)
+ f = open(path, bmode)
fs = FileStack([f])
try:
cf = open_compressed_file(
diff --git a/gemato/hash.py b/gemato/hash.py
index 1423994..fbb6a8b 100644
--- a/gemato/hash.py
+++ b/gemato/hash.py
@@ -77,7 +77,7 @@ def hash_path(path, hash_names):
specified as @hash_names. Returns a dict of (hash_name -> hex value)
mappings.
"""
- with io.open(path, 'rb') as f:
+ with open(path, 'rb') as f:
return hash_file(f, hash_names)
diff --git a/gemato/verify.py b/gemato/verify.py
index 707a43f..720decc 100644
--- a/gemato/verify.py
+++ b/gemato/verify.py
@@ -6,7 +6,6 @@
import contextlib
import errno
import fcntl
-import io
import os
import stat
@@ -100,7 +99,7 @@ def get_file_metadata(path, hashes):
# 5. st_mtime
yield st.st_mtime
- f = io.open(fd, 'rb')
+ f = open(fd, 'rb')
except Exception:
if opened:
os.close(fd)
diff --git a/utils/gen-test-manifest.py b/utils/gen-test-manifest.py
index 1dcd58a..b7c4530 100755
--- a/utils/gen-test-manifest.py
+++ b/utils/gen-test-manifest.py
@@ -1,7 +1,6 @@
#!/usr/bin/env python
import glob
-import io
import os
import os.path
import sys
@@ -47,7 +46,7 @@ def write_manifest_entries_for_dir(manifest_file, topdir, hashes):
def gen_metamanifests(top_dir, hashes):
- with io.open(os.path.join(top_dir, 'profiles/categories'), 'r') as f:
+ with open(os.path.join(top_dir, 'profiles/categories'), 'r') as f:
categories = [x.strip() for x in f]
alldirs = []
@@ -65,10 +64,10 @@ def gen_metamanifests(top_dir, hashes):
for bm in alldirs:
bmdir = os.path.join(top_dir, bm)
if not list(glob.glob(os.path.join(bmdir, 'Manifest*'))):
- with io.open(os.path.join(bmdir, 'Manifest'), 'w') as f:
+ with open(os.path.join(bmdir, 'Manifest'), 'w') as f:
write_manifest_entries_for_dir(f, bmdir, hashes)
- with io.open(os.path.join(top_dir, 'Manifest'), 'w') as f:
+ with open(os.path.join(top_dir, 'Manifest'), 'w') as f:
write_manifest_entries_for_dir(f, top_dir, hashes)
diff --git a/utils/gen_fast_manifest.py b/utils/gen_fast_manifest.py
index f48fb3e..f9eed6c 100755
--- a/utils/gen_fast_manifest.py
+++ b/utils/gen_fast_manifest.py
@@ -1,14 +1,13 @@
#!/usr/bin/env python
# vim:fileencoding=utf-8
# Ultra-optimized Manifest writing.
-# (c) 2017 Michał Górny
+# (c) 2017-2020 Michał Górny
# Licensed under the terms of 2-clause BSD license
import errno
import glob
import gzip
import hashlib
-import io
import os
import os.path
import sys
@@ -18,7 +17,7 @@ def get_manifest_entry(t, path, relpath):
sha512 = hashlib.sha512()
blake2 = hashlib.blake2b()
- with io.open(path, 'rb') as f:
+ with open(path, 'rb') as f:
buf = f.read()
sha512.update(buf)
blake2.update(buf)
@@ -85,7 +84,7 @@ def gen_manifest(top_dir):
# load DIST and IGNORE entries from existing Manifest
try:
- with io.open(os.path.join(top_dir, 'Manifest'), 'rb') as f:
+ with open(os.path.join(top_dir, 'Manifest'), 'rb') as f:
for l in f:
if l.startswith(b'DIST') or l.startswith(b'IGNORE'):
manifest_entries.append(l.rstrip())
@@ -107,7 +106,7 @@ def gen_manifest(top_dir):
if had_manifest:
os.unlink(os.path.join(top_dir, 'Manifest'))
else:
- with io.open(os.path.join(top_dir, 'Manifest'), 'wb') as f:
+ with open(os.path.join(top_dir, 'Manifest'), 'wb') as f:
f.write(manifest_data)
diff --git a/utils/gen_fast_metamanifest.py b/utils/gen_fast_metamanifest.py
index 0c4e43e..97368d8 100755
--- a/utils/gen_fast_metamanifest.py
+++ b/utils/gen_fast_metamanifest.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# vim:fileencoding=utf-8
# Ultra-optimized Meta-Manifest writing.
-# (c) 2017-2018 Michał Górny
+# (c) 2017-2020 Michał Górny
# Licensed under the terms of 2-clause BSD license
import datetime
@@ -19,7 +19,7 @@ import gen_fast_manifest
def manifest_dir_generator(iter_n):
- with io.open('profiles/categories', 'r') as f:
+ with open('profiles/categories', 'r') as f:
categories = [x.strip() for x in f]
for c in categories:
@@ -83,7 +83,7 @@ def make_toplevel(d, ts, pgp_key):
raise ValueError('GPG error: {}'.format(serr))
data = sout
- with io.open(dsttop, 'wb') as f:
+ with open(dsttop, 'wb') as f:
f.write(data)
break
@@ -93,18 +93,18 @@ def gen_metamanifest(top_dir, pgp_key):
os.chdir(top_dir)
# pre-populate IGNORE entries
- with io.open('metadata/Manifest', 'wb') as f:
+ with open('metadata/Manifest', 'wb') as f:
f.write(b'''IGNORE timestamp
IGNORE timestamp.chk
IGNORE timestamp.commit
IGNORE timestamp.x
''')
for mdir in ('dtd', 'glsa', 'news', 'xml-schema'):
- with io.open(os.path.join('metadata', mdir, 'Manifest'), 'wb') as f:
+ with open(os.path.join('metadata', mdir, 'Manifest'), 'wb') as f:
f.write(b'''IGNORE timestamp.chk
IGNORE timestamp.commit
''')
- with io.open('Manifest', 'wb') as f:
+ with open('Manifest', 'wb') as f:
f.write(b'''IGNORE distfiles
IGNORE local
IGNORE lost+found