Commit 1dae9911 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Fix a bug in python to debian version translation

The "dev" string was translated to ~dev twice, leading to ~~dev.
parent 0bd729c4
...@@ -45,6 +45,8 @@ import os ...@@ -45,6 +45,8 @@ import os
import re import re
import sys import sys
import itertools import itertools
import random
import string
from distutils import log # pylint: disable=E0611 from distutils import log # pylint: disable=E0611
...@@ -330,8 +332,15 @@ def debian_version_from_python_version(pyver): ...@@ -330,8 +332,15 @@ def debian_version_from_python_version(pyver):
# This is the old format # This is the old format
version = pyver.replace("_", "~").replace("rc", "~rc") version = pyver.replace("_", "~").replace("rc", "~rc")
else: else:
# Create a random string that will help as during replacing
rand = ''.join(
random.choice(string.ascii_uppercase) for _ in range(16))
# Replace '.dev' or 'dev' with ~dev. This is needed to make the Debian
# develop version less than the non-develop one. Same thing for the rc
# one.
version = pyver.replace( version = pyver.replace(
".dev", "~dev").replace("dev", "~dev").replace("rc", "~rc") ".dev", rand).replace("dev", "~dev").replace(rand, '~dev').replace(
"rc", "~rc")
codename = utils.get_distribution_codename() codename = utils.get_distribution_codename()
minor = str(get_revision(version, codename)) minor = str(get_revision(version, codename))
return version + "-" + minor + "~" + codename return version + "-" + minor + "~" + codename
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment