[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Git][ftp-team/dak][master] use `... == errno.EFOO` instead of `errno.errorcode[...] == 'EFOO'`



Title: GitLab

Ansgar Burchardt pushed to branch master at Debian FTP Team / dak

Commits:

5 changed files:

Changes:

  • dak/examine_package.py
    ... ... @@ -538,7 +538,7 @@ def get_readme_source (dsc_filename):
    538 538
         try:
    
    539 539
             shutil.rmtree(tempdir)
    
    540 540
         except OSError as e:
    
    541
    -        if errno.errorcode[e.errno] != 'EACCES':
    
    541
    +        if e.errno != errno.EACCES:
    
    542 542
                 res += "%s: couldn't remove tmp dir %s for source tree." % (dsc_filename, tempdir)
    
    543 543
     
    
    544 544
         return res
    
    ... ... @@ -666,7 +666,7 @@ def main ():
    666 666
                         less_process.wait()
    
    667 667
                         sys.stdout = stdout_fd
    
    668 668
             except IOError as e:
    
    669
    -            if errno.errorcode[e.errno] == 'EPIPE':
    
    669
    +            if e.errno == errno.EPIPE:
    
    670 670
                     utils.warn("[examine-package] Caught EPIPE; skipping.")
    
    671 671
                     pass
    
    672 672
                 else:
    

  • dak/new_security_install.py
    ... ... @@ -33,7 +33,6 @@ import time
    33 33
     import apt_pkg
    
    34 34
     import commands
    
    35 35
     import errno
    
    36
    -from errno import EACCES, EAGAIN
    
    37 36
     import fcntl
    
    38 37
     
    
    39 38
     from daklib import queue
    
    ... ... @@ -96,7 +95,7 @@ def _do_Approve():
    96 95
                 fcntl.flock(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
    
    97 96
                 break
    
    98 97
             except IOError as e:
    
    99
    -            if errno.errorcode[e.errno] == 'EACCES' or errno.errorcode[e.errno] == 'EAGAIN':
    
    98
    +            if e.errno in (errno.EACCESS, errno.EAGAIN):
    
    100 99
                     print "Another process keeping the unchecked lock, waiting."
    
    101 100
                     time.sleep(10)
    
    102 101
                 else:
    

  • dak/process_upload.py
    ... ... @@ -161,7 +161,6 @@ Checks Debian packages from Incoming
    161 161
     
    
    162 162
     import datetime
    
    163 163
     import errno
    
    164
    -from errno import EACCES, EAGAIN
    
    165 164
     import fcntl
    
    166 165
     import os
    
    167 166
     import sys
    
    ... ... @@ -549,7 +548,7 @@ def main():
    549 548
             try:
    
    550 549
                 fcntl.flock(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
    
    551 550
             except IOError as e:
    
    552
    -            if errno.errorcode[e.errno] == 'EACCES' or errno.errorcode[e.errno] == 'EAGAIN':
    
    551
    +            if e.errno in (errno.EACCES, errno.EAGAIN):
    
    553 552
                     utils.fubar("Couldn't obtain lock; assuming another 'dak process-upload' is already running.")
    
    554 553
                 else:
    
    555 554
                     raise
    

  • dak/transitions.py
    ... ... @@ -226,7 +226,7 @@ def lock_file(f):
    226 226
                 fcntl.flock(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
    
    227 227
                 return lock_fd
    
    228 228
             except OSError as e:
    
    229
    -            if errno.errorcode[e.errno] == 'EACCES' or errno.errorcode[e.errno] == 'EEXIST':
    
    229
    +            if e.errno in (errno.EACCES, errno.EEXIST):
    
    230 230
                     print "Unable to get lock for %s (try %d of 10)" % \
    
    231 231
                             (file, retry+1)
    
    232 232
                     time.sleep(60)
    

  • dak/update_db.py
    ... ... @@ -229,7 +229,7 @@ Updates dak's database schema to the lastest version. You should disable crontab
    229 229
                 else:
    
    230 230
                     utils.warn("Lock directory doesn't exist yet - not locking")
    
    231 231
             except IOError as e:
    
    232
    -            if errno.errorcode[e.errno] == 'EACCES' or errno.errorcode[e.errno] == 'EAGAIN':
    
    232
    +            if e.errno in (errno.EACCES, errno.EAGAIN):
    
    233 233
                     utils.fubar("Couldn't obtain lock, looks like archive is doing something, try again later.")
    
    234 234
     
    
    235 235
             self.update_db()
    


  • Reply to: