aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-07-17 06:38:42 +0200
committerMichał Górny <mgorny@gentoo.org>2020-07-17 08:36:19 +0200
commit070b5268486d5a1443a0dc6c1317c704c1298218 (patch)
treedc137dfd25342bd8985a31e6c57cbbbacca13f19 /lib/_emerge
parentRemove support code for Python < 3.3 (diff)
downloadportage-070b5268486d5a1443a0dc6c1317c704c1298218.tar.gz
portage-070b5268486d5a1443a0dc6c1317c704c1298218.tar.bz2
portage-070b5268486d5a1443a0dc6c1317c704c1298218.zip
Remove support code for Python < 3.4
Reviewed-by: Zac Medico <zmedico@gentoo.org> Closes: https://github.com/gentoo/portage/pull/576 Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'lib/_emerge')
-rw-r--r--lib/_emerge/AsynchronousLock.py12
-rw-r--r--lib/_emerge/EbuildMetadataPhase.py12
-rw-r--r--lib/_emerge/FifoIpcDaemon.py30
-rw-r--r--lib/_emerge/PipeReader.py12
-rw-r--r--lib/_emerge/SpawnProcess.py16
5 files changed, 4 insertions, 78 deletions
diff --git a/lib/_emerge/AsynchronousLock.py b/lib/_emerge/AsynchronousLock.py
index aed1bcb15..d2a6773ff 100644
--- a/lib/_emerge/AsynchronousLock.py
+++ b/lib/_emerge/AsynchronousLock.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2018 Gentoo Foundation
+# Copyright 2010-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
import fcntl
@@ -192,16 +192,6 @@ class _LockProcess(AbstractPollTask):
fcntl.fcntl(in_pr, fcntl.F_SETFL,
fcntl.fcntl(in_pr, fcntl.F_GETFL) | os.O_NONBLOCK)
- # FD_CLOEXEC is enabled by default in Python >=3.4.
- if sys.hexversion < 0x3040000:
- try:
- fcntl.FD_CLOEXEC
- except AttributeError:
- pass
- else:
- fcntl.fcntl(in_pr, fcntl.F_SETFD,
- fcntl.fcntl(in_pr, fcntl.F_GETFD) | fcntl.FD_CLOEXEC)
-
self.scheduler.add_reader(in_pr, self._output_handler)
self._registered = True
self._proc = SpawnProcess(
diff --git a/lib/_emerge/EbuildMetadataPhase.py b/lib/_emerge/EbuildMetadataPhase.py
index efe71892c..d00f194c2 100644
--- a/lib/_emerge/EbuildMetadataPhase.py
+++ b/lib/_emerge/EbuildMetadataPhase.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
from _emerge.SubProcess import SubProcess
@@ -93,16 +93,6 @@ class EbuildMetadataPhase(SubProcess):
fcntl.fcntl(master_fd, fcntl.F_SETFL,
fcntl.fcntl(master_fd, fcntl.F_GETFL) | os.O_NONBLOCK)
- # FD_CLOEXEC is enabled by default in Python >=3.4.
- if sys.hexversion < 0x3040000:
- try:
- fcntl.FD_CLOEXEC
- except AttributeError:
- pass
- else:
- fcntl.fcntl(master_fd, fcntl.F_SETFD,
- fcntl.fcntl(master_fd, fcntl.F_GETFD) | fcntl.FD_CLOEXEC)
-
fd_pipes[slave_fd] = slave_fd
settings["PORTAGE_PIPE_FD"] = str(slave_fd)
diff --git a/lib/_emerge/FifoIpcDaemon.py b/lib/_emerge/FifoIpcDaemon.py
index 2ec69d1cb..ab1fdb572 100644
--- a/lib/_emerge/FifoIpcDaemon.py
+++ b/lib/_emerge/FifoIpcDaemon.py
@@ -1,14 +1,8 @@
-# Copyright 2010-2018 Gentoo Foundation
+# Copyright 2010-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
import sys
-try:
- import fcntl
-except ImportError:
- # http://bugs.jython.org/issue1074
- fcntl = None
-
from portage import os
from _emerge.AbstractPollTask import AbstractPollTask
from portage.cache.mappings import slot_dict_class
@@ -28,17 +22,6 @@ class FifoIpcDaemon(AbstractPollTask):
self._files.pipe_in = \
os.open(self.input_fifo, os.O_RDONLY|os.O_NONBLOCK)
- # FD_CLOEXEC is enabled by default in Python >=3.4.
- if sys.hexversion < 0x3040000 and fcntl is not None:
- try:
- fcntl.FD_CLOEXEC
- except AttributeError:
- pass
- else:
- fcntl.fcntl(self._files.pipe_in, fcntl.F_SETFD,
- fcntl.fcntl(self._files.pipe_in,
- fcntl.F_GETFD) | fcntl.FD_CLOEXEC)
-
self.scheduler.add_reader(
self._files.pipe_in,
self._input_handler)
@@ -55,17 +38,6 @@ class FifoIpcDaemon(AbstractPollTask):
self._files.pipe_in = \
os.open(self.input_fifo, os.O_RDONLY|os.O_NONBLOCK)
- # FD_CLOEXEC is enabled by default in Python >=3.4.
- if sys.hexversion < 0x3040000 and fcntl is not None:
- try:
- fcntl.FD_CLOEXEC
- except AttributeError:
- pass
- else:
- fcntl.fcntl(self._files.pipe_in, fcntl.F_SETFD,
- fcntl.fcntl(self._files.pipe_in,
- fcntl.F_GETFD) | fcntl.FD_CLOEXEC)
-
self.scheduler.add_reader(
self._files.pipe_in,
self._input_handler)
diff --git a/lib/_emerge/PipeReader.py b/lib/_emerge/PipeReader.py
index 1aa5ee3bf..90a31679e 100644
--- a/lib/_emerge/PipeReader.py
+++ b/lib/_emerge/PipeReader.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
import fcntl
@@ -27,16 +27,6 @@ class PipeReader(AbstractPollTask):
fcntl.fcntl(fd, fcntl.F_SETFL,
fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK)
- # FD_CLOEXEC is enabled by default in Python >=3.4.
- if sys.hexversion < 0x3040000:
- try:
- fcntl.FD_CLOEXEC
- except AttributeError:
- pass
- else:
- fcntl.fcntl(fd, fcntl.F_SETFD,
- fcntl.fcntl(fd, fcntl.F_GETFD) | fcntl.FD_CLOEXEC)
-
if self._use_array:
self.scheduler.add_reader(fd, self._array_output_handler, f)
else:
diff --git a/lib/_emerge/SpawnProcess.py b/lib/_emerge/SpawnProcess.py
index 60239a65a..91f5ed1a8 100644
--- a/lib/_emerge/SpawnProcess.py
+++ b/lib/_emerge/SpawnProcess.py
@@ -1,12 +1,6 @@
# Copyright 2008-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-try:
- import fcntl
-except ImportError:
- # http://bugs.jython.org/issue1074
- fcntl = None
-
import errno
import logging
import signal
@@ -129,16 +123,6 @@ class SpawnProcess(SubProcess):
stdout_fd = None
if can_log and not self.background:
stdout_fd = os.dup(fd_pipes_orig[1])
- # FD_CLOEXEC is enabled by default in Python >=3.4.
- if sys.hexversion < 0x3040000 and fcntl is not None:
- try:
- fcntl.FD_CLOEXEC
- except AttributeError:
- pass
- else:
- fcntl.fcntl(stdout_fd, fcntl.F_SETFD,
- fcntl.fcntl(stdout_fd,
- fcntl.F_GETFD) | fcntl.FD_CLOEXEC)
build_logger = BuildLogger(env=self.env,
log_path=log_file_path,