#153 Use open() instead of file() for opening files
Merged 6 years ago by kevin. Opened 6 years ago by lbalhar.
lbalhar/fedora-packager file_open  into  master

file modified
+1 -1
@@ -62,7 +62,7 @@ 

  

      # Look for configuration in the local git configuration

      proc = subprocess.Popen('git rev-parse --git-dir',

-         stdout=file("/dev/null", 'w'), shell=True)

+         stdout=open("/dev/null", 'w'), shell=True)

      ret = os.WEXITSTATUS(os.waitpid(proc.pid, 0)[1])

      if ret == 0:

          raw_value = subprocess.Popen(['git', 'config',

file modified
+1 -1
@@ -91,7 +91,7 @@ 

  

      """

      if os.path.exists(os.path.expanduser('~/.fedora.upn')):

-         with file(os.path.expanduser('~/.fedora.upn'), 'r') as f:

+         with open(os.path.expanduser('~/.fedora.upn'), 'r') as f:

              return f.read().replace('\n', '')

  

      my_cert = _open_cert()

open() is preferred way how to open files in Python and file() is not available in Python 3. This seems to be only one Python 3 incompatibility in fedora-packager.

rebased onto b16e311

6 years ago

FWIW the change looks good to me, though It would probably be a good idea to drop fedora-hosted.py since the service is no more.

Pull-Request has been merged by kevin

6 years ago