/usr/lib/python2.7/dist-packages/macsypy/utils.py is in macsyfinder 1.0.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # -*- coding: utf-8 -*-
################################################################################
# MacSyFinder - Detection of macromolecular systems in protein datasets #
# using systems modelling and similarity search. #
# Authors: Sophie Abby, Bertrand Néron #
# Copyright © 2014 Institut Pasteur, Paris. #
# See the COPYRIGHT file for details #
# #
# MacsyFinder is distributed under the terms of the GNU General Public License #
# (GPLv3). See the COPYING file for details. #
################################################################################
import os
import platform
def which(name, flags=os.X_OK):
"""
Search PATH for executable files with the given name.
:param name: the name of the executable to search
:type name: str
:param flags: os mod the name must have, default is executable (os.X_OK).
:type flags: os file mode R_OK|R_OK|W_OK|X_OK
:return: the path of the executable
:rtype: string or None
"""
result = None
path = os.environ.get('PATH', None)
if path is None:
return result
for p in os.environ.get('PATH', '').split(os.pathsep):
p = os.path.join(p, name)
if platform.system() == 'Windows':
p += '.exe'
if os.access(p, flags):
result = p
break
return result
|