[entropy*] create const_mkstemp() as tempfile.mkstemp() wrapper.
using /tmp as TMPDIR is a no go, since on modern systems, /tmp is on tmpfs with a very limited amount of fs size assigned. Use /var/tmp/entropy (or /var/tmp as fallback) instead.
This commit is contained in:
@@ -15,10 +15,9 @@ import os
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
from entropy.const import const_convert_to_unicode, etpConst, \
|
||||
const_debug_write
|
||||
const_debug_write, const_mkstemp
|
||||
from entropy.i18n import _, ngettext
|
||||
from entropy.output import darkgreen, blue, purple, teal, brown, bold, \
|
||||
darkred, readtext, is_interactive
|
||||
@@ -748,7 +747,7 @@ class SoloManage(SoloCommand):
|
||||
def _get_license_text(license_name, repository_id):
|
||||
repo = entropy_client.open_repository(repository_id)
|
||||
text = repo.retrieveLicenseText(license_name)
|
||||
tmp_fd, tmp_path = tempfile.mkstemp()
|
||||
tmp_fd, tmp_path = const_mkstemp(prefix="LICENSES.")
|
||||
# text is binary string, do not use codecs.open()
|
||||
with os.fdopen(tmp_fd, "wb") as tmp_f:
|
||||
tmp_f.write(text)
|
||||
|
||||
@@ -14,9 +14,9 @@ import errno
|
||||
import sys
|
||||
import argparse
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
from entropy.const import const_convert_to_unicode, const_is_python3
|
||||
from entropy.const import const_convert_to_unicode, const_is_python3, \
|
||||
const_mkstemp
|
||||
if const_is_python3():
|
||||
from subprocess import getoutput
|
||||
else:
|
||||
@@ -313,7 +313,7 @@ Manage package file updates.
|
||||
|
||||
fd, tmp_path = None, None
|
||||
try:
|
||||
fd, tmp_path = tempfile.mkstemp(
|
||||
fd, tmp_path = const_mkstemp(
|
||||
suffix="equo.conf.showdiff")
|
||||
with os.fdopen(fd, "w") as f:
|
||||
f.writelines(coloured)
|
||||
@@ -502,7 +502,7 @@ Manage package file updates.
|
||||
def _interactive_merge_diff(self, source, destination):
|
||||
tmp_fd, tmp_path = None, None
|
||||
try:
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
suffix="equo.conf.intmerge")
|
||||
args = ("/usr/bin/sdiff", "-o", tmp_path,
|
||||
source, destination)
|
||||
|
||||
@@ -12,11 +12,10 @@
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
import tempfile
|
||||
import shutil
|
||||
|
||||
from entropy.const import etpConst, const_setup_directory, \
|
||||
const_convert_to_unicode, const_convert_to_rawstring
|
||||
const_convert_to_unicode, const_convert_to_rawstring, const_mkstemp
|
||||
from entropy.i18n import _
|
||||
from entropy.output import darkgreen, teal, brown, purple, darkred, blue
|
||||
|
||||
@@ -351,7 +350,7 @@ Execute advanced tasks on Entropy packages and the running system.
|
||||
shutil.move(package_path, final_path)
|
||||
package_path = final_path
|
||||
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix="equo.smart.inflate.",
|
||||
dir=savedir)
|
||||
os.close(tmp_fd)
|
||||
|
||||
@@ -13,12 +13,11 @@ import os
|
||||
import errno
|
||||
import sys
|
||||
import argparse
|
||||
import tempfile
|
||||
|
||||
from entropy.i18n import _
|
||||
from entropy.output import red, bold, brown, blue, darkred, darkgreen, \
|
||||
purple, teal
|
||||
from entropy.const import etpConst
|
||||
from entropy.const import etpConst, const_mkstemp
|
||||
from entropy.exceptions import SystemDatabaseError
|
||||
from entropy.db.exceptions import OperationalError, DatabaseError
|
||||
from entropy.client.interfaces.db import InstalledPackagesRepository
|
||||
@@ -451,7 +450,7 @@ Tools to rescue the running system.
|
||||
total = len(spm_packages)
|
||||
count = 0
|
||||
# perf: reuse temp file
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix="equo.rescue.generate")
|
||||
os.close(tmp_fd)
|
||||
|
||||
@@ -715,7 +714,7 @@ Tools to rescue the running system.
|
||||
total = len(to_be_added)
|
||||
counter = 0
|
||||
# perf: only create temp file once
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix="equo.rescue.spmsync")
|
||||
os.close(tmp_fd)
|
||||
|
||||
|
||||
+2
-3
@@ -12,7 +12,6 @@
|
||||
import os
|
||||
import sys
|
||||
import errno
|
||||
import tempfile
|
||||
import pdb
|
||||
|
||||
from entropy.i18n import _
|
||||
@@ -20,7 +19,7 @@ from entropy.output import print_error, print_warning, bold, purple, \
|
||||
teal, blue, darkred, darkgreen, readtext, print_generic, TextInterface, \
|
||||
is_stdout_a_tty, nocolor
|
||||
from entropy.const import etpConst, const_convert_to_rawstring, \
|
||||
const_convert_to_unicode, const_debug_enabled
|
||||
const_convert_to_unicode, const_debug_enabled, const_mkstemp
|
||||
from entropy.exceptions import SystemDatabaseError, OnlineMirrorError, \
|
||||
RepositoryError, PermissionDenied, FileNotFound, SPMError
|
||||
|
||||
@@ -122,7 +121,7 @@ def handle_exception(exc_class, exc_instance, exc_tb):
|
||||
|
||||
error_fd, error_file = None, None
|
||||
try:
|
||||
error_fd, error_file = tempfile.mkstemp(
|
||||
error_fd, error_file = const_mkstemp(
|
||||
prefix="entropy.error.report.",
|
||||
suffix=".txt")
|
||||
|
||||
|
||||
@@ -15,13 +15,12 @@ import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import threading
|
||||
import time
|
||||
|
||||
from entropy.const import const_debug_write, const_setup_perms, etpConst, \
|
||||
const_set_nice_level, const_setup_file, const_convert_to_unicode, \
|
||||
const_debug_enabled, const_mkdtemp
|
||||
const_debug_enabled, const_mkdtemp, const_mkstemp
|
||||
from entropy.output import blue, darkred, red, darkgreen, purple, teal, brown, \
|
||||
bold, TextInterface
|
||||
from entropy.dump import dumpobj, loadobj
|
||||
@@ -1935,7 +1934,7 @@ class AvailablePackagesRepositoryUpdater(object):
|
||||
tmp_fd, tmp_path = None, None
|
||||
rev = "-1"
|
||||
try:
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix = "AvailableEntropyRepository.remote_revision")
|
||||
fetcher = self._entropy._url_fetcher(
|
||||
url, tmp_path, resume = False)
|
||||
|
||||
@@ -18,7 +18,6 @@ import sys
|
||||
import shutil
|
||||
import time
|
||||
import subprocess
|
||||
import tempfile
|
||||
import threading
|
||||
import codecs
|
||||
import copy
|
||||
@@ -28,7 +27,8 @@ from entropy.i18n import _
|
||||
from entropy.const import etpConst, const_debug_write, etpSys, \
|
||||
const_setup_file, initconfig_entropy_constants, const_pid_exists, \
|
||||
const_setup_perms, const_isstring, const_convert_to_unicode, \
|
||||
const_isnumber, const_convert_to_rawstring, const_mkdtemp
|
||||
const_isnumber, const_convert_to_rawstring, const_mkdtemp, \
|
||||
const_mkstemp
|
||||
from entropy.exceptions import RepositoryError, SystemDatabaseError, \
|
||||
RepositoryPluginError, SecurityError, EntropyPackageException
|
||||
from entropy.db.skel import EntropyRepositoryBase
|
||||
@@ -904,7 +904,7 @@ class RepositoryMixin:
|
||||
if package_file_path.endswith(etpConst['packagesext_webinstall']):
|
||||
webinstall_package = True
|
||||
# unbzip2
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(dir = db_dir)
|
||||
tmp_fd, tmp_path = const_mkstemp(dir = db_dir)
|
||||
try:
|
||||
entropy.tools.uncompress_file(dbfile, tmp_path, bz2.BZ2File)
|
||||
finally:
|
||||
@@ -1192,7 +1192,7 @@ class RepositoryMixin:
|
||||
@rtype: entropy.client.interfaces.db.GenericRepository
|
||||
"""
|
||||
if temp_file is None:
|
||||
tmp_fd, temp_file = tempfile.mkstemp(
|
||||
tmp_fd, temp_file = const_mkstemp(
|
||||
prefix="entropy.client.methods.open_temp_repository")
|
||||
os.close(tmp_fd)
|
||||
if dbname is not None:
|
||||
@@ -2078,7 +2078,7 @@ class MiscMixin:
|
||||
|
||||
for mirror in mirrors:
|
||||
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix="entropy.client.methods.reorder_mirrors")
|
||||
try:
|
||||
|
||||
@@ -2330,7 +2330,7 @@ class MiscMixin:
|
||||
tmp_path = initialized_repository_path
|
||||
already_initialized = True
|
||||
else:
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix="entropy.client.methods._inject_edb")
|
||||
|
||||
try:
|
||||
@@ -2781,7 +2781,7 @@ class MatchMixin:
|
||||
enc = etpConst['conf_encoding']
|
||||
for mask_file in new_mask_list:
|
||||
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix="entropy.client.methods._clear_match_gen")
|
||||
|
||||
with codecs.open(mask_file, "r", encoding=enc) as mask_f:
|
||||
|
||||
@@ -14,11 +14,10 @@ import os
|
||||
import errno
|
||||
import stat
|
||||
import shutil
|
||||
import tempfile
|
||||
import time
|
||||
import codecs
|
||||
|
||||
from entropy.const import etpConst, const_setup_perms, \
|
||||
from entropy.const import etpConst, const_setup_perms, const_mkstemp, \
|
||||
const_isunicode, const_convert_to_unicode, const_debug_write, \
|
||||
const_debug_enabled, const_convert_to_rawstring, const_is_python3
|
||||
from entropy.exceptions import PermissionDenied, SPMError
|
||||
@@ -1466,7 +1465,7 @@ class Package:
|
||||
return None
|
||||
|
||||
# write gpg signature to disk for verification
|
||||
tmp_fd, tmp_path = tempfile.mkstemp()
|
||||
tmp_fd, tmp_path = const_mkstemp(prefix="do_compare_gpg")
|
||||
with os.fdopen(tmp_fd, "w") as tmp_f:
|
||||
tmp_f.write(hash_val)
|
||||
tmp_f.flush()
|
||||
@@ -4422,7 +4421,7 @@ class Package:
|
||||
tmp_fd, tmp_path = None, None
|
||||
generated = False
|
||||
try:
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix="PackageContentSafety",
|
||||
dir=tmp_dir)
|
||||
with Package.FileContentSafetyWriter(tmp_fd) as tmp_f:
|
||||
@@ -4468,7 +4467,7 @@ class Package:
|
||||
tmp_fd, tmp_path = None, None
|
||||
generated = False
|
||||
try:
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix="PackageContent",
|
||||
dir=tmp_dir)
|
||||
with Package.FileContentWriter(tmp_fd) as tmp_f:
|
||||
|
||||
@@ -12,12 +12,11 @@
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
import codecs
|
||||
|
||||
from entropy.client.interfaces.client import Client
|
||||
from entropy.const import etpConst, const_isunicode, etpSys, \
|
||||
const_convert_to_rawstring
|
||||
const_convert_to_rawstring, const_mkstemp
|
||||
from entropy.output import brown, bold, darkred, red, teal, purple
|
||||
from entropy.i18n import _
|
||||
|
||||
@@ -453,7 +452,7 @@ class Trigger:
|
||||
|
||||
entropy_sh = "#!%s" % (etpConst['trigger_sh_interpreter'],)
|
||||
entropy_sh = const_convert_to_rawstring(entropy_sh)
|
||||
tmp_fd, tmp_path = tempfile.mkstemp()
|
||||
tmp_fd, tmp_path = const_mkstemp(prefix="_do_trigger_call_ext_generic")
|
||||
with os.fdopen(tmp_fd, "ab+") as tr_f:
|
||||
tr_f.write(const_convert_to_rawstring(self._pkgdata['trigger']))
|
||||
tr_f.flush()
|
||||
|
||||
@@ -26,10 +26,9 @@ if const_is_python3():
|
||||
from io import StringIO
|
||||
else:
|
||||
from cStringIO import StringIO
|
||||
import tempfile
|
||||
|
||||
from entropy.const import const_get_stringtype, etpConst, const_setup_perms, \
|
||||
const_convert_to_rawstring, const_convert_to_unicode
|
||||
const_convert_to_rawstring, const_convert_to_unicode, const_mkstemp
|
||||
from entropy.i18n import _
|
||||
from entropy.services.client import WebServiceFactory, WebService
|
||||
from entropy.fetchers import UrlFetcher
|
||||
@@ -1380,7 +1379,7 @@ class ClientWebService(WebService):
|
||||
local_document_dir = os.path.dirname(local_document)
|
||||
tmp_fd, tmp_path = None, None
|
||||
try:
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
dir=local_document_dir, prefix="get_document_url")
|
||||
|
||||
fetcher = self._entropy._url_fetcher(
|
||||
|
||||
@@ -1039,6 +1039,35 @@ def const_mkdtemp(dir=None, prefix=None, suffix=None):
|
||||
suffix = ""
|
||||
return tempfile.mkdtemp(dir=dir, prefix=prefix, suffix=suffix)
|
||||
|
||||
def const_mkstemp(dir=None, prefix=None, suffix=None):
|
||||
"""
|
||||
mkstemp() wrapper that creates a temporary file inside
|
||||
etpConst['entropyunpackdir'] if dir is None.
|
||||
|
||||
@keyword dir: TMPDIR
|
||||
@type dir: string
|
||||
@keyword prefix: the mkdtemp prefix argument
|
||||
@type prefix: string
|
||||
@keyword suffix: the mkdtemp suffix argument
|
||||
@type suffix: string
|
||||
@rtype: tuple
|
||||
@return: the temporary file fd and path tuple
|
||||
"""
|
||||
if dir is None:
|
||||
dir = etpConst['entropyunpackdir']
|
||||
# try creating it only if it's our provided dir
|
||||
try:
|
||||
os.makedirs(dir)
|
||||
except OSError as err:
|
||||
if err.errno != errno.EEXIST:
|
||||
dir = os.getenv("TMPDIR", "/var/tmp")
|
||||
|
||||
if prefix is None:
|
||||
prefix = ""
|
||||
if suffix is None:
|
||||
suffix = ""
|
||||
return tempfile.mkstemp(dir=dir, prefix=prefix, suffix=suffix)
|
||||
|
||||
def const_get_chmod(myfile):
|
||||
"""
|
||||
This function get the current permissions of the specified
|
||||
|
||||
@@ -12,13 +12,12 @@ import os
|
||||
import shutil
|
||||
import warnings
|
||||
import hashlib
|
||||
import tempfile
|
||||
import codecs
|
||||
|
||||
from entropy.i18n import _
|
||||
from entropy.exceptions import InvalidAtom
|
||||
from entropy.const import etpConst, const_cmp, const_debug_write, \
|
||||
const_is_python3
|
||||
const_mkstemp, const_is_python3
|
||||
from entropy.output import TextInterface, brown, bold, red, blue, purple, \
|
||||
darkred
|
||||
from entropy.cache import EntropyCacher
|
||||
@@ -1604,7 +1603,7 @@ class EntropyRepositoryBase(TextInterface, EntropyRepositoryPluginStore):
|
||||
tmp_fd, tmp_path = None, None
|
||||
try:
|
||||
with codecs.open(file_path, "r", encoding=enc) as source_f:
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix="entropy.db._runConfigurationFilesUpdate",
|
||||
dir=os.path.dirname(file_path))
|
||||
with entropy.tools.codecs_fdopen(tmp_fd, "w", enc) \
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
|
||||
"""
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
from entropy.const import const_debug_write, const_setup_file, etpConst
|
||||
from entropy.const import const_debug_write, const_setup_file, \
|
||||
const_mkstemp, etpConst
|
||||
|
||||
class DebugList(list):
|
||||
|
||||
@@ -246,7 +246,7 @@ class GraphDrawer(object):
|
||||
Generate a PNG from current Graph content.
|
||||
"""
|
||||
graph = self._generate_pydot()
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(prefix="entropy.graph",
|
||||
tmp_fd, tmp_path = const_mkstemp(prefix="entropy.graph",
|
||||
suffix=".png")
|
||||
os.close(tmp_fd)
|
||||
graph.write_png(tmp_path)
|
||||
@@ -258,7 +258,7 @@ class GraphDrawer(object):
|
||||
Generate RAW dot file that can be used to feed graphviz
|
||||
"""
|
||||
graph = self._generate_pydot()
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(prefix="entropy.graph",
|
||||
tmp_fd, tmp_path = const_mkstemp(prefix="entropy.graph",
|
||||
suffix=".dot")
|
||||
os.close(tmp_fd)
|
||||
graph.write_raw(tmp_path)
|
||||
|
||||
+3
-3
@@ -26,9 +26,9 @@
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
import tempfile
|
||||
|
||||
from entropy.const import etpConst, const_setup_file, const_is_python3
|
||||
from entropy.const import etpConst, const_setup_file, const_is_python3, \
|
||||
const_mkstemp
|
||||
# Always use MAX pickle protocol to <=2, to allow Python 2 and 3 support
|
||||
COMPAT_PICKLE_PROTOCOL = 0
|
||||
|
||||
@@ -107,7 +107,7 @@ def dumpobj(name, my_object, complete_path = False, ignore_exceptions = True,
|
||||
const_setup_file(d_path, E_GID, 0o775)
|
||||
|
||||
dmp_name = os.path.basename(dmpfile)
|
||||
tmp_fd, tmp_dmpfile = tempfile.mkstemp(
|
||||
tmp_fd, tmp_dmpfile = const_mkstemp(
|
||||
dir=c_dump_dir, prefix=dmp_name)
|
||||
# WARNING: it has been observed that using
|
||||
# os.fdopen() below in multi-threaded scenarios
|
||||
|
||||
+3
-3
@@ -21,14 +21,14 @@
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import tempfile
|
||||
import stat
|
||||
import codecs
|
||||
|
||||
from entropy.output import TextInterface
|
||||
from entropy.misc import Lifo
|
||||
from entropy.const import etpConst, etpSys, const_debug_write, const_mkdtemp, \
|
||||
const_debug_write, const_convert_to_rawstring, const_is_python3
|
||||
const_mkstemp, const_debug_write, const_convert_to_rawstring, \
|
||||
const_is_python3
|
||||
from entropy.output import blue, darkgreen, red, darkred, bold, purple, brown, \
|
||||
teal
|
||||
from entropy.exceptions import PermissionDenied, SystemDatabaseError
|
||||
@@ -1514,7 +1514,7 @@ class QAInterface(TextInterface, EntropyPluginStore):
|
||||
fd, tmp_path = None, None
|
||||
dbc = None
|
||||
try:
|
||||
fd, tmp_path = tempfile.mkstemp(
|
||||
fd, tmp_path = const_mkstemp(
|
||||
prefix="entropy.qa.__analyze_package_edb")
|
||||
dump_rc = entropy.tools.dump_entropy_metadata(pkg_path, tmp_path)
|
||||
if not dump_rc:
|
||||
|
||||
@@ -20,14 +20,13 @@
|
||||
import errno
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
import time
|
||||
import bz2
|
||||
import codecs
|
||||
import threading
|
||||
|
||||
from entropy.const import etpConst, const_setup_file, const_mkdtemp, \
|
||||
const_convert_to_unicode
|
||||
const_mkstemp, const_convert_to_unicode
|
||||
from entropy.core import Singleton
|
||||
from entropy.db import EntropyRepository
|
||||
from entropy.transceivers import EntropyTransceiver
|
||||
@@ -1020,7 +1019,7 @@ Name: %s
|
||||
self._repository_id)
|
||||
enc = etpConst['conf_encoding']
|
||||
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
dir=os.path.dirname(changelog_path))
|
||||
|
||||
with entropy.tools.codecs_fdopen(tmp_fd, "w", enc) as tmp_f:
|
||||
|
||||
@@ -19,7 +19,6 @@ import shutil
|
||||
import stat
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
from entropy.exceptions import OnlineMirrorError, PermissionDenied, \
|
||||
@@ -27,7 +26,8 @@ from entropy.exceptions import OnlineMirrorError, PermissionDenied, \
|
||||
from entropy.const import etpConst, etpSys, const_setup_perms, \
|
||||
const_create_working_dirs, const_convert_to_unicode, \
|
||||
const_setup_file, const_get_stringtype, const_debug_write, \
|
||||
const_debug_enabled, const_convert_to_rawstring, const_mkdtemp
|
||||
const_debug_enabled, const_convert_to_rawstring, const_mkdtemp, \
|
||||
const_mkstemp
|
||||
from entropy.output import purple, red, darkgreen, \
|
||||
bold, brown, blue, darkred, teal
|
||||
from entropy.cache import EntropyCacher
|
||||
@@ -1445,7 +1445,7 @@ class ServerQAInterfacePlugin(QAInterfacePlugin):
|
||||
return True
|
||||
return False
|
||||
|
||||
tmp_fd, tmp_f = tempfile.mkstemp(prefix = 'entropy.server')
|
||||
tmp_fd, tmp_f = const_mkstemp(prefix = 'entropy.server')
|
||||
dbc = None
|
||||
try:
|
||||
found_edb = entropy.tools.dump_entropy_metadata(package_path, tmp_f)
|
||||
@@ -3158,7 +3158,7 @@ class Server(Client):
|
||||
orig_fd = None
|
||||
tmp_repo_orig_path = None
|
||||
try:
|
||||
orig_fd, tmp_repo_orig_path = tempfile.mkstemp(
|
||||
orig_fd, tmp_repo_orig_path = const_mkstemp(
|
||||
prefix="entropy.server._inject")
|
||||
|
||||
empty_repo = GenericRepository(
|
||||
@@ -3186,7 +3186,7 @@ class Server(Client):
|
||||
tmp_repo_file = None
|
||||
tmp_fd = None
|
||||
try:
|
||||
tmp_fd, tmp_repo_file = tempfile.mkstemp(
|
||||
tmp_fd, tmp_repo_file = const_mkstemp(
|
||||
prefix="entropy.server._inject_for")
|
||||
with os.fdopen(tmp_fd, "wb") as tmp_f:
|
||||
with open(tmp_repo_orig_path, "rb") as empty_f:
|
||||
@@ -4871,7 +4871,7 @@ class Server(Client):
|
||||
if not found:
|
||||
new_content.append("default-repository = %s" % (repoid,))
|
||||
|
||||
tmp_fd, tmp_path = tempfile.mkstemp()
|
||||
tmp_fd, tmp_path = const_mkstemp(prefix="_save_default_repository")
|
||||
with entropy.tools.codecs_fdopen(tmp_fd, "w", enc) as f_srv_t:
|
||||
for line in new_content:
|
||||
f_srv_t.write(line+"\n")
|
||||
@@ -4935,7 +4935,7 @@ class Server(Client):
|
||||
raise
|
||||
return None
|
||||
|
||||
tmp_fd, tmp_path = tempfile.mkstemp()
|
||||
tmp_fd, tmp_path = const_mkstemp(prefix="_toggle_repository")
|
||||
with entropy.tools.codecs_fdopen(tmp_fd, "w", enc) as f_tmp:
|
||||
status = False
|
||||
for line in content:
|
||||
@@ -5116,7 +5116,7 @@ class Server(Client):
|
||||
@type output_interface: entropy.output.TextInterface based instance
|
||||
"""
|
||||
if temp_file is None:
|
||||
tmp_fd, temp_file = tempfile.mkstemp(prefix = 'entropy.server')
|
||||
tmp_fd, temp_file = const_mkstemp(prefix = 'entropy.server')
|
||||
os.close(tmp_fd)
|
||||
|
||||
conn = ServerPackagesRepository(
|
||||
@@ -5770,7 +5770,7 @@ class Server(Client):
|
||||
while True:
|
||||
|
||||
if tmp_path is None:
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(prefix = 'entropy.server',
|
||||
tmp_fd, tmp_path = const_mkstemp(prefix = 'entropy.server',
|
||||
suffix = ".conf")
|
||||
with entropy.tools.codecs_fdopen(tmp_fd, "w", enc) as tmp_f:
|
||||
tmp_f.write(header_txt)
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
"""
|
||||
import os
|
||||
import tempfile
|
||||
import shutil
|
||||
import time
|
||||
import errno
|
||||
@@ -22,7 +21,8 @@ import codecs
|
||||
from entropy.exceptions import EntropyPackageException
|
||||
from entropy.output import red, darkgreen, bold, brown, blue, darkred, \
|
||||
darkblue, purple, teal
|
||||
from entropy.const import etpConst, const_get_int, const_get_cpus, const_mkdtemp
|
||||
from entropy.const import etpConst, const_get_int, const_get_cpus, \
|
||||
const_mkdtemp, const_mkstemp
|
||||
from entropy.cache import EntropyCacher
|
||||
from entropy.i18n import _
|
||||
from entropy.misc import RSS, ParallelTask
|
||||
@@ -685,7 +685,7 @@ class Server(object):
|
||||
if not (rc1 and rc2):
|
||||
return (uri, revision)
|
||||
|
||||
tmp_fd, rev_tmp_path = tempfile.mkstemp(prefix = "entropy.server")
|
||||
tmp_fd, rev_tmp_path = const_mkstemp(prefix = "entropy.server")
|
||||
try:
|
||||
|
||||
dlcount = 5
|
||||
|
||||
@@ -15,14 +15,13 @@ import sys
|
||||
import os
|
||||
import errno
|
||||
import json
|
||||
import tempfile
|
||||
import threading
|
||||
import hashlib
|
||||
|
||||
import socket
|
||||
|
||||
from entropy.const import const_is_python3, const_convert_to_rawstring, \
|
||||
const_get_int
|
||||
const_get_int, const_mkstemp
|
||||
|
||||
if const_is_python3():
|
||||
import http.client as httplib
|
||||
@@ -394,7 +393,7 @@ class WebService(object):
|
||||
return repr(value)
|
||||
return value
|
||||
|
||||
tmp_fd, tmp_path = tempfile.mkstemp()
|
||||
tmp_fd, tmp_path = const_mkstemp(prefix="_encode_multipart_form")
|
||||
tmp_f = os.fdopen(tmp_fd, "ab+")
|
||||
tmp_f.truncate(0)
|
||||
crlf = '\r\n'
|
||||
@@ -953,7 +952,7 @@ class WebService(object):
|
||||
expected_hash = md5.hexdigest()
|
||||
func_name = "data_send_available"
|
||||
|
||||
tmp_fd, tmp_path = tempfile.mkstemp()
|
||||
tmp_fd, tmp_path = const_mkstemp(prefix="data_send_available")
|
||||
try:
|
||||
with os.fdopen(tmp_fd, "ab+") as tmp_f:
|
||||
tmp_f.write(test_str)
|
||||
|
||||
@@ -18,7 +18,6 @@ import stat
|
||||
import sys
|
||||
import shutil
|
||||
import stat
|
||||
import tempfile
|
||||
import subprocess
|
||||
import tarfile
|
||||
import time
|
||||
@@ -28,7 +27,7 @@ import warnings
|
||||
from entropy.const import etpConst, const_get_stringtype, \
|
||||
const_convert_to_unicode, const_convert_to_rawstring, \
|
||||
const_setup_perms, const_setup_file, const_is_python3, \
|
||||
const_debug_enabled, const_mkdtemp
|
||||
const_debug_enabled, const_mkdtemp, const_mkstemp
|
||||
from entropy.exceptions import FileNotFound, InvalidDependString, \
|
||||
InvalidAtom, EntropyException
|
||||
from entropy.output import darkred, darkgreen, brown, darkblue, teal, \
|
||||
@@ -1019,7 +1018,7 @@ class PortagePlugin(SpmPlugin):
|
||||
tmp_fd, tmp_file = None, None
|
||||
debug_tmp_fd, debug_tmp_file = None, None
|
||||
try:
|
||||
tmp_fd, tmp_file = tempfile.mkstemp(dir = file_save_dir,
|
||||
tmp_fd, tmp_file = const_mkstemp(dir = file_save_dir,
|
||||
prefix = "entropy.spm.Portage.generate_package._tar")
|
||||
os.close(tmp_fd)
|
||||
tmp_fd = None
|
||||
@@ -1037,7 +1036,7 @@ class PortagePlugin(SpmPlugin):
|
||||
m.update(repr(package))
|
||||
debug_file_save_path = file_save_name + "." + m.hexdigest() + \
|
||||
etpConst['packagesdebugext']
|
||||
debug_tmp_fd, debug_tmp_file = tempfile.mkstemp(
|
||||
debug_tmp_fd, debug_tmp_file = const_mkstemp(
|
||||
dir = file_save_dir,
|
||||
prefix = "entropy.spm.Portage.generate_package._debug_tar")
|
||||
os.close(debug_tmp_fd)
|
||||
@@ -1160,7 +1159,7 @@ class PortagePlugin(SpmPlugin):
|
||||
warnings.warn("Something is wrong, no modinfo on the system")
|
||||
return
|
||||
|
||||
tmp_fd, tmp_file = tempfile.mkstemp(
|
||||
tmp_fd, tmp_file = const_mkstemp(
|
||||
prefix="entropy.spm.portage._add_kernel_dependency_to_pkg")
|
||||
try:
|
||||
with os.fdopen(tmp_fd, "w") as tmp_fw:
|
||||
@@ -1240,7 +1239,7 @@ class PortagePlugin(SpmPlugin):
|
||||
raw_enc = etpConst['conf_raw_encoding']
|
||||
|
||||
try:
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix="entropy.spm.__source_env_get_var")
|
||||
|
||||
sts = subprocess.call(args, stdout = tmp_fd)
|
||||
@@ -2137,7 +2136,7 @@ class PortagePlugin(SpmPlugin):
|
||||
splitter_err = None
|
||||
try:
|
||||
if is_mute():
|
||||
tmp_fd, tmp_file = tempfile.mkstemp(
|
||||
tmp_fd, tmp_file = const_mkstemp(
|
||||
prefix="entropy.spm.portage._portage_doebuild")
|
||||
tmp_fw = os.fdopen(tmp_fd, "w")
|
||||
sys.stdout = tmp_fw
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
"""
|
||||
import sys
|
||||
import tempfile
|
||||
import os
|
||||
import errno
|
||||
import shutil
|
||||
from entropy.const import etpConst, const_is_python3, const_mkdtemp
|
||||
from entropy.const import etpConst, const_is_python3, const_mkdtemp, \
|
||||
const_mkstemp
|
||||
from entropy.output import TextInterface
|
||||
from entropy.spm.plugins.factory import get_default_instance
|
||||
from entropy.spm.plugins.interfaces.portage_plugin import xpak
|
||||
@@ -31,7 +31,7 @@ def extract_xpak(tbz2file, tmpdir = None):
|
||||
@rtype:
|
||||
"""
|
||||
# extract xpak content
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix="entropy.spm.portage.extract_xpak")
|
||||
os.close(tmp_fd)
|
||||
try:
|
||||
@@ -56,7 +56,7 @@ def read_xpak(tbz2file):
|
||||
@return:
|
||||
@rtype:
|
||||
"""
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix="entropy.spm.portage.read_xpak")
|
||||
os.close(tmp_fd)
|
||||
try:
|
||||
|
||||
+14
-14
@@ -21,7 +21,6 @@ import os
|
||||
import time
|
||||
import shutil
|
||||
import tarfile
|
||||
import tempfile
|
||||
import subprocess
|
||||
import grp
|
||||
import pwd
|
||||
@@ -36,7 +35,8 @@ import codecs
|
||||
from entropy.output import print_generic
|
||||
from entropy.const import etpConst, const_kill_threads, const_islive, \
|
||||
const_isunicode, const_convert_to_unicode, const_convert_to_rawstring, \
|
||||
const_israwstring, const_secure_config_file, const_is_python3
|
||||
const_israwstring, const_secure_config_file, const_is_python3, \
|
||||
const_mkstemp
|
||||
from entropy.exceptions import FileNotFound, InvalidAtom, DirectoryNotFound
|
||||
|
||||
def is_root():
|
||||
@@ -768,7 +768,7 @@ def atomic_write(filepath, content_str, encoding):
|
||||
"""
|
||||
tmp_fd, tmp_path = None, None
|
||||
try:
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(prefix="atomic_write.")
|
||||
tmp_fd, tmp_path = const_mkstemp(prefix="atomic_write.")
|
||||
with codecs_fdopen(tmp_fd, "w", encoding) as tmp_f:
|
||||
tmp_f.write(content_str)
|
||||
tmp_f.flush()
|
||||
@@ -1160,7 +1160,7 @@ def unpack_gzip(gzipfilepath):
|
||||
@rtype: string
|
||||
"""
|
||||
filepath = gzipfilepath[:-3] # remove .gz
|
||||
fd, tmp_path = tempfile.mkstemp(dir=os.path.dirname(filepath))
|
||||
fd, tmp_path = const_mkstemp(dir=os.path.dirname(filepath))
|
||||
with os.fdopen(fd, "wb") as item:
|
||||
filegz = gzip.GzipFile(gzipfilepath, "rb")
|
||||
chunk = filegz.read(8192)
|
||||
@@ -1182,7 +1182,7 @@ def unpack_bzip2(bzip2filepath):
|
||||
@rtype: string
|
||||
"""
|
||||
filepath = bzip2filepath[:-4] # remove .bz2
|
||||
fd, tmp_path = tempfile.mkstemp(dir=os.path.dirname(filepath))
|
||||
fd, tmp_path = const_mkstemp(dir=os.path.dirname(filepath))
|
||||
with os.fdopen(fd, "wb") as item:
|
||||
filebz2 = bz2.BZ2File(bzip2filepath, "rb")
|
||||
chunk = filebz2.read(16384)
|
||||
@@ -1292,12 +1292,12 @@ def generate_entropy_delta(pkg_path_a, pkg_path_b, hash_tag,
|
||||
else:
|
||||
_delta_extractor = _DELTA_DECOMPRESSION_MAP[pkg_compression]
|
||||
|
||||
tmp_fd_a, tmp_path_a = tempfile.mkstemp(dir=os.path.dirname(pkg_path_a))
|
||||
tmp_fd_b, tmp_path_b = tempfile.mkstemp(dir=os.path.dirname(pkg_path_b))
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd_a, tmp_path_a = const_mkstemp(dir=os.path.dirname(pkg_path_a))
|
||||
tmp_fd_b, tmp_path_b = const_mkstemp(dir=os.path.dirname(pkg_path_b))
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix="entropy.tools.generate_entropy_delta")
|
||||
os.close(tmp_fd)
|
||||
tmp_fd_spm, tmp_path_spm = tempfile.mkstemp(
|
||||
tmp_fd_spm, tmp_path_spm = const_mkstemp(
|
||||
prefix="entropy.tools.generate_entropy_delta")
|
||||
os.close(tmp_fd_spm)
|
||||
|
||||
@@ -1378,18 +1378,18 @@ def apply_entropy_delta(pkg_path_a, delta_path, new_pkg_path_b,
|
||||
_pkg_extractor = _DELTA_DECOMPRESSION_MAP[pkg_compression]
|
||||
used_compression = _DELTA_COMPRESSION_MAP[pkg_compression]
|
||||
|
||||
tmp_fd, tmp_delta_path = tempfile.mkstemp(dir=os.path.dirname(delta_path))
|
||||
tmp_fd, tmp_delta_path = const_mkstemp(dir=os.path.dirname(delta_path))
|
||||
os.close(tmp_fd)
|
||||
tmp_spm_fd, tmp_spm_path = tempfile.mkstemp(dir=os.path.dirname(delta_path))
|
||||
tmp_spm_fd, tmp_spm_path = const_mkstemp(dir=os.path.dirname(delta_path))
|
||||
os.close(tmp_spm_fd)
|
||||
|
||||
tmp_fd_a, tmp_path_a = tempfile.mkstemp(dir=os.path.dirname(pkg_path_a))
|
||||
tmp_meta_fd, tmp_metadata_path = tempfile.mkstemp(
|
||||
tmp_fd_a, tmp_path_a = const_mkstemp(dir=os.path.dirname(pkg_path_a))
|
||||
tmp_meta_fd, tmp_metadata_path = const_mkstemp(
|
||||
dir=os.path.dirname(new_pkg_path_b))
|
||||
os.close(tmp_meta_fd)
|
||||
|
||||
tmp_fd_null, tmp_path_null = \
|
||||
tempfile.mkstemp(dir=os.path.dirname(delta_path))
|
||||
const_mkstemp(dir=os.path.dirname(delta_path))
|
||||
|
||||
new_pkg_path_b_tmp = new_pkg_path_b + ".edelta_work"
|
||||
new_pkg_path_b_tmp_compressed = new_pkg_path_b_tmp + ".compress"
|
||||
|
||||
@@ -12,9 +12,8 @@
|
||||
import os
|
||||
import time
|
||||
import socket
|
||||
import tempfile
|
||||
|
||||
from entropy.const import const_debug_write
|
||||
from entropy.const import const_debug_write, const_mkstemp
|
||||
from entropy.tools import print_traceback, get_file_size, \
|
||||
convert_seconds_to_fancy_output, bytes_into_human, spliturl
|
||||
from entropy.output import blue, brown, darkgreen, red
|
||||
@@ -495,7 +494,7 @@ class EntropyFtpUriHandler(EntropyUriHandler):
|
||||
# now we can create the lock file reliably
|
||||
tmp_fd, tmp_path = None, None
|
||||
try:
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(prefix="entropy.txc.ftp.lock")
|
||||
tmp_fd, tmp_path = const_mkstemp(prefix="entropy.txc.ftp.lock")
|
||||
# check if remote_ptr is already there
|
||||
if self._is_path_available(remote_ptr):
|
||||
return False
|
||||
|
||||
@@ -13,12 +13,11 @@ import re
|
||||
import os
|
||||
import errno
|
||||
import time
|
||||
import tempfile
|
||||
import shutil
|
||||
import codecs
|
||||
|
||||
from entropy.const import const_isnumber, const_debug_write, \
|
||||
const_mkdtemp, etpConst
|
||||
const_mkdtemp, const_mkstemp, etpConst
|
||||
from entropy.output import brown, darkgreen, teal
|
||||
from entropy.i18n import _
|
||||
from entropy.transceivers.exceptions import TransceiverConnectionError
|
||||
@@ -185,8 +184,8 @@ class EntropySshUriHandler(EntropyUriHandler):
|
||||
|
||||
def _exec_cmd(self, args):
|
||||
|
||||
fd, tmp_path = tempfile.mkstemp(prefix="entropy.transceivers.ssh_plug")
|
||||
fd_err, tmp_path_err = tempfile.mkstemp(
|
||||
fd, tmp_path = const_mkstemp(prefix="entropy.transceivers.ssh_plug")
|
||||
fd_err, tmp_path_err = const_mkstemp(
|
||||
prefix="entropy.transceivers.ssh_plug")
|
||||
try:
|
||||
with os.fdopen(fd, "wb") as std_f:
|
||||
@@ -336,7 +335,7 @@ class EntropySshUriHandler(EntropyUriHandler):
|
||||
tmp_file_map = {}
|
||||
try:
|
||||
for load_path in load_path_list:
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
suffix = EntropyUriHandler.TMP_TXC_FILE_EXT,
|
||||
prefix = "._%s" % (os.path.basename(load_path),))
|
||||
os.close(tmp_fd)
|
||||
|
||||
@@ -23,7 +23,6 @@ import sys
|
||||
import pwd
|
||||
import time
|
||||
import signal
|
||||
import tempfile
|
||||
import shutil
|
||||
import subprocess
|
||||
import copy
|
||||
@@ -61,7 +60,8 @@ from entropy.cache import EntropyCacher
|
||||
EntropyCacher.WRITEBACK_TIMEOUT = 120
|
||||
|
||||
from entropy.const import etpConst, const_convert_to_rawstring, \
|
||||
initconfig_entropy_constants, const_debug_write, dump_signal
|
||||
initconfig_entropy_constants, const_debug_write, dump_signal, \
|
||||
const_mkstemp
|
||||
from entropy.exceptions import DependenciesNotFound, \
|
||||
DependenciesCollision, DependenciesNotRemovable, SystemDatabaseError, \
|
||||
EntropyPackageException
|
||||
@@ -2758,7 +2758,7 @@ class RigoDaemonService(dbus.service.Object):
|
||||
if busied:
|
||||
# Setup Application Management
|
||||
# Install/Remove notes
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix="RigoDaemonAppMgmt",
|
||||
suffix=".notes")
|
||||
with self._app_mgmt_mutex:
|
||||
@@ -3013,7 +3013,7 @@ class RigoDaemonService(dbus.service.Object):
|
||||
tmp_fd, tmp_path = None, None
|
||||
path = ""
|
||||
try:
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix="RigoDaemon", suffix=".diff")
|
||||
with os.fdopen(tmp_fd, "wb") as tmp_f:
|
||||
rc = subprocess.call(
|
||||
@@ -3077,7 +3077,7 @@ class RigoDaemonService(dbus.service.Object):
|
||||
Prepare the given configuration file copying it to
|
||||
a temporary path and setting proper permissions.
|
||||
"""
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(prefix="RigoDaemon")
|
||||
tmp_fd, tmp_path = const_mkstemp(prefix="RigoDaemon")
|
||||
try:
|
||||
with os.fdopen(tmp_fd, "wb") as tmp_f:
|
||||
with open(path, "rb") as path_f:
|
||||
|
||||
@@ -23,10 +23,11 @@ this program; if not, write to the Free Software Foundation, Inc.,
|
||||
import os
|
||||
import logging
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
from gi.repository import Gtk, GdkPixbuf, GObject
|
||||
|
||||
from entropy.const import const_mkstemp
|
||||
|
||||
from rigo.paths import ICON_PATH
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@@ -91,7 +92,7 @@ def get_sc_icon_theme(datadir):
|
||||
|
||||
def resize_image(max_width, image_path, final_image_path):
|
||||
dirname = os.path.dirname(final_image_path)
|
||||
tmp_fd, new_image_path = tempfile.mkstemp(
|
||||
tmp_fd, new_image_path = const_mkstemp(
|
||||
dir=dirname, prefix="resize_image")
|
||||
os.close(tmp_fd)
|
||||
|
||||
@@ -117,7 +118,7 @@ def resize_image(max_width, image_path, final_image_path):
|
||||
|
||||
def resize_image_height(max_height, image_path, final_image_path):
|
||||
dirname = os.path.dirname(final_image_path)
|
||||
tmp_fd, new_image_path = tempfile.mkstemp(
|
||||
tmp_fd, new_image_path = const_mkstemp(
|
||||
dir=dirname, prefix="resize_image")
|
||||
os.close(tmp_fd)
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ this program; if not, write to the Free Software Foundation, Inc.,
|
||||
"""
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
import time
|
||||
from threading import Timer, Semaphore, Lock
|
||||
|
||||
@@ -33,7 +32,7 @@ from rigo.models.application import Application
|
||||
from rigo.enums import AppActions, LocalActivityStates, RigoViewStates
|
||||
|
||||
from entropy.const import etpConst, const_convert_to_unicode, \
|
||||
const_debug_write
|
||||
const_debug_write, const_mkstemp
|
||||
from entropy.i18n import _, ngettext
|
||||
from entropy.services.client import WebService
|
||||
from entropy.misc import ParallelTask, TimeScheduled
|
||||
@@ -571,7 +570,7 @@ class LicensesNotificationBox(NotificationBox):
|
||||
self._entropy.rwsem().reader_release()
|
||||
|
||||
if license_text is not None:
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(suffix=".txt")
|
||||
tmp_fd, tmp_path = const_mkstemp(suffix=".txt")
|
||||
try:
|
||||
license_text = const_convert_to_unicode(
|
||||
license_text, enctype=etpConst['conf_encoding'])
|
||||
|
||||
@@ -13,11 +13,11 @@ import sys
|
||||
import os
|
||||
import errno
|
||||
import argparse
|
||||
import tempfile
|
||||
import codecs
|
||||
|
||||
from entropy.i18n import _
|
||||
from entropy.output import blue, darkred, darkgreen, purple, brown, teal
|
||||
from entropy.const import const_mkstemp
|
||||
|
||||
from eit.commands.descriptor import EitCommandDescriptor
|
||||
from eit.commands.command import EitCommand
|
||||
@@ -118,7 +118,7 @@ list notice-board titles for user consumption.
|
||||
while True:
|
||||
|
||||
if tmp_path is None:
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix = 'entropy.server',
|
||||
suffix = ".conf")
|
||||
with os.fdopen(tmp_fd, "w") as tmp_f:
|
||||
|
||||
@@ -13,11 +13,11 @@ import sys
|
||||
import os
|
||||
import errno
|
||||
import argparse
|
||||
import tempfile
|
||||
import codecs
|
||||
|
||||
from entropy.i18n import _
|
||||
from entropy.output import purple, teal
|
||||
from entropy.const import const_mkstemp
|
||||
|
||||
from eit.commands.descriptor import EitCommandDescriptor
|
||||
from eit.commands.command import EitCommand
|
||||
@@ -147,7 +147,7 @@ doing.
|
||||
while True:
|
||||
|
||||
if tmp_path is None:
|
||||
tmp_fd, tmp_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_path = const_mkstemp(
|
||||
prefix = 'entropy.server.pkgmove',
|
||||
suffix = ".conf")
|
||||
with os.fdopen(tmp_fd, "w") as tmp_f:
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
import sys
|
||||
import os
|
||||
import argparse
|
||||
import tempfile
|
||||
import codecs
|
||||
|
||||
from entropy.const import etpConst, const_convert_to_unicode
|
||||
from entropy.const import etpConst, const_convert_to_unicode, \
|
||||
const_mkstemp
|
||||
from entropy.exceptions import OnlineMirrorError
|
||||
from entropy.i18n import _
|
||||
from entropy.output import darkgreen, teal, red, darkred, brown, blue, \
|
||||
@@ -179,7 +179,7 @@ repository) by pushing updated data.
|
||||
Store inside rss metadata object.
|
||||
"""
|
||||
enc = etpConst['conf_encoding']
|
||||
tmp_fd, tmp_commit_path = tempfile.mkstemp(
|
||||
tmp_fd, tmp_commit_path = const_mkstemp(
|
||||
prefix="eit._push", suffix=".COMMIT_MSG")
|
||||
with entropy.tools.codecs_fdopen(tmp_fd, "w", enc) as tmp_f:
|
||||
tmp_f.write(EitPush.DEFAULT_REPO_COMMIT_MSG)
|
||||
|
||||
Reference in New Issue
Block a user