Skip to content

Commit 99036b9

Browse files
author
Viktoria
committed
Remove using paramiko
1 parent 6cb3a80 commit 99036b9

File tree

6 files changed

+94
-132
lines changed

6 files changed

+94
-132
lines changed

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"six>=1.9.0",
1313
"psutil",
1414
"packaging",
15-
"paramiko",
1615
"fabric",
1716
"sshtunnel"
1817
]

testgres/cache.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def call_initdb(initdb_dir, log=logfile):
5757
# our initdb caching mechanism breaks this contract.
5858
pg_control = os.path.join(data_dir, XLOG_CONTROL_FILE)
5959
system_id = generate_system_id()
60-
os_ops.write(pg_control, system_id, truncate=True, binary=True, read_and_write=True)
60+
cur_pg_control = os_ops.read(pg_control, binary=True)
61+
new_pg_control = system_id + cur_pg_control[len(system_id):]
62+
os_ops.write(pg_control, new_pg_control, truncate=True, binary=True, read_and_write=True)
6163

6264
# XXX: build new WAL segment with our system id
6365
_params = [get_bin_path("pg_resetwal"), "-D", data_dir, "-f"]

testgres/operations/local_ops.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,13 @@ def touch(self, filename):
198198
with open(filename, "a"):
199199
os.utime(filename, None)
200200

201-
def read(self, filename, encoding=None):
202-
with open(filename, "r", encoding=encoding) as file:
203-
return file.read()
201+
def read(self, filename, encoding=None, binary=False):
202+
mode = "rb" if binary else "r"
203+
with open(filename, mode) as file:
204+
if binary:
205+
return file.read()
206+
return file.read().decode(encoding or 'utf-8')
207+
204208

205209
def readlines(self, filename, num_lines=0, binary=False, encoding=None):
206210
"""

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy