Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-ptyprocess for 
openSUSE:Factory checked in at 2021-02-01 13:26:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-ptyprocess (Old)
 and      /work/SRC/openSUSE:Factory/.python-ptyprocess.new.28504 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-ptyprocess"

Mon Feb  1 13:26:35 2021 rev:8 rq:866398 version:0.7.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-ptyprocess/python-ptyprocess.changes      
2020-06-11 14:45:00.393435736 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-ptyprocess.new.28504/python-ptyprocess.changes
   2021-02-01 13:28:26.970126050 +0100
@@ -1,0 +2,7 @@
+Sun Jan 24 18:13:49 UTC 2021 - Dirk M??ller <dmuel...@suse.com>
+
+- update to 0.7.0:
+  * Add pass_fds parameters (#49)
+  * Switch to Github actions for CI 
+
+-------------------------------------------------------------------

Old:
----
  ptyprocess-0.6.0.tar.gz

New:
----
  ptyprocess-0.7.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-ptyprocess.spec ++++++
--- /var/tmp/diff_new_pack.h9xpch/_old  2021-02-01 13:28:27.602127034 +0100
+++ /var/tmp/diff_new_pack.h9xpch/_new  2021-02-01 13:28:27.602127034 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-ptyprocess
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-ptyprocess
-Version:        0.6.0
+Version:        0.7.0
 Release:        0
 Summary:        Run a subprocess in a pseudo terminal
 License:        ISC

++++++ ptyprocess-0.6.0.tar.gz -> ptyprocess-0.7.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ptyprocess-0.6.0/.github/workflows/test.yml 
new/ptyprocess-0.7.0/.github/workflows/test.yml
--- old/ptyprocess-0.6.0/.github/workflows/test.yml     1970-01-01 
01:00:00.000000000 +0100
+++ new/ptyprocess-0.7.0/.github/workflows/test.yml     2020-12-28 
16:13:46.125647500 +0100
@@ -0,0 +1,24 @@
+name: Test
+
+on: [push, pull_request]
+
+jobs:
+  test:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        python-version: [ 3.5, 3.6, 3.7, 3.8, 3.9, 2.7 ]
+    steps:
+      - uses: actions/checkout@v2
+
+      - name: Setup Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v2
+        with:
+          python-version: ${{ matrix.python-version }}
+
+      - name: Install dependencies
+        run: |
+          pip install pytest
+
+      - name: Run tests
+        run: pytest -v
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ptyprocess-0.6.0/.travis.yml 
new/ptyprocess-0.7.0/.travis.yml
--- old/ptyprocess-0.6.0/.travis.yml    2018-06-22 10:30:09.084751800 +0200
+++ new/ptyprocess-0.7.0/.travis.yml    1970-01-01 01:00:00.000000000 +0100
@@ -1,9 +0,0 @@
-language: python
-python:
-  - "3.6"
-  - "3.5"
-  - "3.4"
-  - "2.7"
-# command to run tests
-script: py.test --verbose --verbose
-sudo: False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ptyprocess-0.6.0/PKG-INFO 
new/ptyprocess-0.7.0/PKG-INFO
--- old/ptyprocess-0.6.0/PKG-INFO       1970-01-01 01:00:00.000000000 +0100
+++ new/ptyprocess-0.7.0/PKG-INFO       1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: ptyprocess
-Version: 0.6.0
+Version: 0.7.0
 Summary: Run a subprocess in a pseudo terminal
 Home-page: https://github.com/pexpect/ptyprocess
 Author: Thomas Kluyver
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ptyprocess-0.6.0/docs/conf.py 
new/ptyprocess-0.7.0/docs/conf.py
--- old/ptyprocess-0.6.0/docs/conf.py   2017-07-01 23:19:37.478078000 +0200
+++ new/ptyprocess-0.7.0/docs/conf.py   2020-12-28 16:13:18.195637700 +0100
@@ -55,9 +55,9 @@
 # built documents.
 #
 # The short X.Y version.
-version = '0.5'
+version = '0.7'
 # The full version, including alpha/beta/rc tags.
-release = version + '.2'
+release = version #+ '.2'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ptyprocess-0.6.0/ptyprocess/__init__.py 
new/ptyprocess-0.7.0/ptyprocess/__init__.py
--- old/ptyprocess-0.6.0/ptyprocess/__init__.py 2018-06-22 10:28:26.157719400 
+0200
+++ new/ptyprocess-0.7.0/ptyprocess/__init__.py 2020-12-28 16:13:18.182637700 
+0100
@@ -1,4 +1,4 @@
 """Run a subprocess in a pseudo terminal"""
 from .ptyprocess import PtyProcess, PtyProcessUnicode, PtyProcessError
 
-__version__ = '0.6.0'
+__version__ = '0.7.0'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ptyprocess-0.6.0/ptyprocess/ptyprocess.py 
new/ptyprocess-0.7.0/ptyprocess/ptyprocess.py
--- old/ptyprocess-0.6.0/ptyprocess/ptyprocess.py       2018-06-22 
10:22:19.183169100 +0200
+++ new/ptyprocess-0.7.0/ptyprocess/ptyprocess.py       2020-12-28 
15:31:40.890978000 +0100
@@ -178,7 +178,7 @@
     @classmethod
     def spawn(
             cls, argv, cwd=None, env=None, echo=True, preexec_fn=None,
-            dimensions=(24, 80)):
+            dimensions=(24, 80), pass_fds=()):
         '''Start the given command in a child process in a pseudo terminal.
 
         This does all the fork/exec type of stuff for a pty, and returns an
@@ -190,6 +190,10 @@
 
         Dimensions of the psuedoterminal used for the subprocess can be
         specified as a tuple (rows, cols), or the default (24, 80) will be 
used.
+
+        By default, all file descriptors except 0, 1 and 2 are closed. This
+        behavior can be overridden with pass_fds, a list of file descriptors to
+        keep open between the parent and the child.
         '''
         # Note that it is difficult for this method to fail.
         # You cannot detect if the child process cannot start.
@@ -255,12 +259,14 @@
 
             # Do not allow child to inherit open file descriptors from parent,
             # with the exception of the exec_err_pipe_write of the pipe
+            # and pass_fds.
             # Impose ceiling on max_fd: AIX bugfix for users with unlimited
             # nofiles where resource.RLIMIT_NOFILE is 2^63-1 and 
os.closerange()
             # occasionally raises out of range error
             max_fd = min(1048576, 
resource.getrlimit(resource.RLIMIT_NOFILE)[0])
-            os.closerange(3, exec_err_pipe_write)
-            os.closerange(exec_err_pipe_write+1, max_fd)
+            spass_fds = sorted(set(pass_fds) | {exec_err_pipe_write})
+            for pair in zip([2] + spass_fds, spass_fds + [max_fd]):
+                os.closerange(pair[0]+1, pair[1])
 
             if cwd is not None:
                 os.chdir(cwd)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ptyprocess-0.6.0/pyproject.toml 
new/ptyprocess-0.7.0/pyproject.toml
--- old/ptyprocess-0.6.0/pyproject.toml 2018-06-22 10:27:25.242292000 +0200
+++ new/ptyprocess-0.7.0/pyproject.toml 2020-12-28 16:13:46.125647500 +0100
@@ -1,6 +1,6 @@
 [build-system]
-requires = ["flit"]
-build-backend = "flit.buildapi"
+requires = ["flit_core >=2,<4"]
+build-backend = "flit_core.buildapi"
 
 [tool.flit.metadata]
 module = "ptyprocess"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ptyprocess-0.6.0/setup.py 
new/ptyprocess-0.7.0/setup.py
--- old/ptyprocess-0.6.0/setup.py       1970-01-01 01:00:00.000000000 +0100
+++ new/ptyprocess-0.7.0/setup.py       1970-01-01 01:00:00.000000000 +0100
@@ -10,7 +10,7 @@
 {'': ['*']}
 
 setup(name='ptyprocess',
-      version='0.6.0',
+      version='0.7.0',
       description='Run a subprocess in a pseudo terminal',
       author='Thomas Kluyver',
       author_email='tho...@kluyver.me.uk',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ptyprocess-0.6.0/tests/test_spawn.py 
new/ptyprocess-0.7.0/tests/test_spawn.py
--- old/ptyprocess-0.6.0/tests/test_spawn.py    2015-12-09 17:48:31.281371400 
+0100
+++ new/ptyprocess-0.7.0/tests/test_spawn.py    2020-12-28 15:31:40.890978000 
+0100
@@ -1,6 +1,8 @@
+import fcntl
 import os
 import time
 import select
+import tempfile
 import unittest
 from ptyprocess.ptyprocess import which
 from ptyprocess import PtyProcess, PtyProcessUnicode
@@ -111,3 +113,37 @@
     @unittest.skipIf(which('bc') is None, "bc(1) not found on this server.")
     def test_interactive_repl_unicode_echo(self):
         self._interactive_repl_unicode(echo=True)
+
+    def test_pass_fds(self):
+        with tempfile.NamedTemporaryFile() as temp_file:
+            temp_file_fd = temp_file.fileno()
+            temp_file_name = temp_file.name
+
+            # Temporary files are CLOEXEC by default
+            fcntl.fcntl(temp_file_fd,
+                        fcntl.F_SETFD,
+                        fcntl.fcntl(temp_file_fd, fcntl.F_GETFD) &
+                        ~fcntl.FD_CLOEXEC)
+
+            # You can write with pass_fds
+            p = PtyProcess.spawn(['bash',
+                                  '-c',
+                                  'printf hello >&{}'.format(temp_file_fd)],
+                                 echo=True,
+                                 pass_fds=(temp_file_fd,))
+            p.wait()
+            assert p.status == 0
+
+            with open(temp_file_name, 'r') as temp_file_r:
+                assert temp_file_r.read() == 'hello'
+
+            # You can't write without pass_fds
+            p = PtyProcess.spawn(['bash',
+                                  '-c',
+                                  'printf bye >&{}'.format(temp_file_fd)],
+                                 echo=True)
+            p.wait()
+            assert p.status != 0
+
+            with open(temp_file_name, 'r') as temp_file_r:
+                assert temp_file_r.read() == 'hello'

Reply via email to