Skip to content
Snippets Groups Projects
Commit c5ce1c3f authored by Piotr Ożarowski's avatar Piotr Ożarowski
Browse files

testing my commit rights

parents 95e46e93 02a9b23e
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
import re import re
import optparse import optparse
from copy import copy from copy import copy
......
...@@ -118,13 +118,16 @@ def shebang2pyver(fname): ...@@ -118,13 +118,16 @@ def shebang2pyver(fname):
:rtype: tuple :rtype: tuple
:returns: pair of Python interpreter string and Python version :returns: pair of Python interpreter string and Python version
""" """
with open(fname) as fp: try:
data = fp.read(32) with open(fname) as fp:
match = SHEBANG_RE.match(data) data = fp.read(32)
if not match: match = SHEBANG_RE.match(data)
return None if not match:
res = match.groups() return None
if res != (None, None): res = match.groups()
if res[1]: if res != (None, None):
res = res[0], getver(res[1]) if res[1]:
return res res = res[0], getver(res[1])
return res
except IOError:
log.error('cannot open %s', fname)
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
import re import re
from os.path import exists from os.path import exists
from types import GeneratorType from types import GeneratorType
...@@ -229,7 +230,7 @@ def getver(value): ...@@ -229,7 +230,7 @@ def getver(value):
""" """
if not value: if not value:
return '' return ''
return tuple(int(i) for i in value.split('.'))[:2] return tuple(int(i) for i in value.split('.', 2))[:2]
def debsorted(versions, return_str=None): def debsorted(versions, return_str=None):
......
...@@ -41,7 +41,7 @@ from debpython.tools import sitedir, relative_symlink, guess_dependency, \ ...@@ -41,7 +41,7 @@ from debpython.tools import sitedir, relative_symlink, guess_dependency, \
from debpython.option import Option from debpython.option import Option
# initialize script # initialize script
logging.basicConfig(format='%(levelname).1s: %(module)s:%(lineno)d: ' +\ logging.basicConfig(format='%(levelname).1s: %(module)s:%(lineno)d: '
'%(message)s') '%(message)s')
log = logging.getLogger('dh_python') log = logging.getLogger('dh_python')
os.umask(022) os.umask(022)
...@@ -382,19 +382,21 @@ def dependencies(package, stats, options): ...@@ -382,19 +382,21 @@ def dependencies(package, stats, options):
depends.append(interpreter) depends.append(interpreter)
# TODO: if versions[0] not in requested_versions: FTBFS # TODO: if versions[0] not in requested_versions: FTBFS
else: # no hardcoded versions else: # no hardcoded versions
dep = '' dep = args = ''
vr = options.vrange vr = options.vrange
if vr: if vr:
args = "-V %s" % vrange_str(vr) args += "-V %s" % vrange_str(vr)
for pattern in options.regexpr or []:
args += " -X '%s'" % pattern.replace("'", r"\'")
rtscripts.append((private_dir, args))
if vr[0]: # minumum version specified if vr[0]: # minumum version specified
dep = "python (>= %s)" % vrepr(vr[0]) dep = "python (>= %s)" % vrepr(vr[0])
if vr[1]: # maximum version specified if vr[1]: # maximum version specified
dep += ", python (<< %s)" % vrepr(vr[1]) dep += ", python (<< %s)" % vrepr(vr[1])
dep = dep.lstrip(', ') dep = dep.lstrip(', ')
if details.get('compile', False):
for pattern in options.regexpr or []:
args += " -X '%s'" % pattern.replace("'", r"\'")
rtscripts.append((private_dir, args))
dep = dep or 'python' dep = dep or 'python'
if dep not in depends: if dep not in depends:
depends.append(dep) depends.append(dep)
...@@ -432,6 +434,8 @@ def parse_pydep(fname): ...@@ -432,6 +434,8 @@ def parse_pydep(fname):
################################################################ ################################################################
def main(): def main():
if exists('debian/pycompat'):
sys.exist(0) # be compatible with old dh_python
usage = '%prog -p PACKAGE [-V [X.Y][-][A.B]] DIR_OR_FILE [-X REGEXPR]\n' usage = '%prog -p PACKAGE [-V [X.Y][-][A.B]] DIR_OR_FILE [-X REGEXPR]\n'
parser = OptionParser(usage, version='%prog 2.0~alpha1', parser = OptionParser(usage, version='%prog 2.0~alpha1',
option_class=Option) option_class=Option)
......
...@@ -34,7 +34,8 @@ from debpython.version import SUPPORTED ...@@ -34,7 +34,8 @@ from debpython.version import SUPPORTED
# initialize script # initialize script
logging.basicConfig() logging.basicConfig(format='%(levelname).1s: %(module)s:%(lineno)d: '
'%(message)s')
log = logging.getLogger('pyclean') log = logging.getLogger('pyclean')
"""TODO: move it to manpage """TODO: move it to manpage
......
...@@ -35,9 +35,10 @@ from debpython.version import SUPPORTED, DEFAULT, debsorted, vrepr, \ ...@@ -35,9 +35,10 @@ from debpython.version import SUPPORTED, DEFAULT, debsorted, vrepr, \
from debpython.option import Option, compile_regexpr from debpython.option import Option, compile_regexpr
# initialize script # initialize script
logging.basicConfig() logging.basicConfig(format='%(levelname).1s: %(module)s:%(lineno)d: '
'%(message)s')
log = logging.getLogger('pycompile') log = logging.getLogger('pycompile')
# TODO: /usr/share/python2/foo/2.5-/bar/-2.7/baz.py # TODO: /usr/share/python3/foo/3.1-/bar/-3.5/baz.py
STDINS = {} STDINS = {}
"""TODO: move it to manpage """TODO: move it to manpage
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment