Skip to content

Commit

Permalink
Python 3.10 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Rakitin committed Sep 20, 2023
1 parent 1903b8c commit 6e3b4f0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
32 changes: 16 additions & 16 deletions pbs/PBSQuery.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Bas van der Vlies ([email protected])
#
# SVN INFO:
# $Id: PBSQuery.py 368 2018-10-22 10:16:12Z bas $
# $Id$
#
"""
Usage: from PBSQuery import PBSQuery
Expand Down Expand Up @@ -59,7 +59,7 @@
nodes = p.getnodes(l)
"""
import pbs
import UserDict
from collections import UserDict
import string
import sys
import re
Expand Down Expand Up @@ -319,7 +319,7 @@ def getqueue(self, name, attrib_list=None):
self._statqueue(name, attrib_list)
try:
return self.d[name]
except KeyError, detail:
except KeyError(detail):
return self.d

def getqueues(self, attrib_list=None):
Expand All @@ -346,7 +346,7 @@ def getnode(self, name, attrib_list=None):
self._statnode(name, attrib_list)
try:
return self.d[name]
except KeyError, detail:
except KeyError(detail):
return self.d

def getnodes(self, attrib_list=None):
Expand Down Expand Up @@ -380,7 +380,7 @@ def getjob(self, name, attrib_list=None):
self._statjob(name, attrib_list)
try:
return self.d[name]
except KeyError, detail:
except KeyError(detail):
return self.d

def getjobs(self, attrib_list=None):
Expand All @@ -403,12 +403,12 @@ def old_data_structure(self):
"""
self.OLD_DATA_STRUCTURE = True

class _PBSobject(UserDict.UserDict):
class _PBSobject(UserDict):
TRUE = 1
FALSE = 0

def __init__(self, dictin = None):
UserDict.UserDict.__init__(self)
UserDict.__init__(self)
self.name = None

if dictin:
Expand Down Expand Up @@ -527,7 +527,7 @@ def has_job(self):
try:
a = self['jobs']
return self.TRUE
except KeyError, detail:
except KeyError(detail):
return self.FALSE

def get_jobs(self, unique=None):
Expand Down Expand Up @@ -601,30 +601,30 @@ def main():
p = PBSQuery()
serverinfo = p.get_serverinfo()
for server in serverinfo.keys():
print server, ' version: ', serverinfo[server].get_version()
print(server, ' version: ', serverinfo[server].get_version())
for resource in serverinfo[server].keys():
print '\t ', resource, ' = ', serverinfo[server][resource]
print('\t ', resource, ' = ', serverinfo[server][resource])

queues = p.getqueues()
for queue in queues.keys():
print queue
print(queue)
if queues[queue].is_execution():
print '\t ', queues[queue]
print('\t ', queues[queue])
if queues[queue].has_key('acl_groups'):
print '\t acl_groups: yes'
print('\t acl_groups: yes')
else:
print '\t acl_groups: no'
print('\t acl_groups: no')

jobs = p.getjobs()
for name,job in jobs.items():
if job.is_running():
print job
print(job)

l = ['state']
nodes = p.getnodes(l)
for name,node in nodes.items():
if node.is_free():
print node
print(node)

if __name__ == "__main__":
main()
Binary file added pbs/_pbs.cpython-310-x86_64-linux-gnu.so
Binary file not shown.
2 changes: 1 addition & 1 deletion pbs/pbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ def use_user_keywords(id, d, l):
resp = getreq(id)
check_resp(d, resp)
else:
raise TypeError('Expected a string got %s :%s' %(type(res), res))
raise TypeError('Expected a string got %s :%s' %(type(res), res))

def get_mom_values(id, list = None):
"""
Expand Down
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys
from setuptools import find_packages, setup
from distutils import sysconfig

Expand All @@ -8,6 +9,9 @@

site_packages_path = sysconfig.get_python_lib(prefix='./')

python_version = sys.version_info
python_version_str = "{}{}".format(python_version.major, python_version.minor)

setup(
name='pbs-python',
setup_requires=['setuptools_scm'],
Expand All @@ -26,15 +30,15 @@
data_files=[
(os.path.join(site_packages_path, 'pbs'), [
'pbs/_pbs.so',
'pbs/_pbs.cpython-38-x86_64-linux-gnu.so'
'pbs/_pbs.cpython-{}-x86_64-linux-gnu.so'.format(python_version_str)
]),
],
extras_require={
"test": [
"coverage[toml]>=5.3",
]
},
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,<3.9',
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*',
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
Expand Down

0 comments on commit 6e3b4f0

Please sign in to comment.