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

dh_python2 and pycompile: read /usr/share/python/debian_defaults to get

default Python version and a List of supported Python versions
parent 1063f88b
No related branches found
No related tags found
No related merge requests found
python-defaults (2.6.6-11) UNRELEASED; urgency=low python-defaults (2.6.6-11) UNRELEASED; urgency=low
* dh_python2 and pycompile: read /usr/share/python/debian_defaults to get
default Python version and a List of supported Python versions
* dh_python2: * dh_python2:
- fix parsing .pyinstall files (a space between file name and - fix parsing .pyinstall files (a space between file name and
module name is now required) module name is now required)
......
...@@ -19,15 +19,38 @@ ...@@ -19,15 +19,38 @@
# 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 logging
import re import re
from os.path import exists from ConfigParser import SafeConfigParser
from os.path import exists, dirname, join
from types import GeneratorType from types import GeneratorType
# will be overriden via debian_defaults file few lines later
SUPPORTED = [(2, 5), (2, 6), (2, 7)] SUPPORTED = [(2, 5), (2, 6), (2, 7)]
DEFAULT = (2, 6) DEFAULT = (2, 6)
RANGE_PATTERN = r'(-)?(\d\.\d+)(?:(-)(\d\.\d+)?)?' RANGE_PATTERN = r'(-)?(\d\.\d+)(?:(-)(\d\.\d+)?)?'
RANGE_RE = re.compile(RANGE_PATTERN) RANGE_RE = re.compile(RANGE_PATTERN)
log = logging.getLogger(__name__)
# try to read debian_defaults and get a list of supported Python versions and
# the default one from there
_config = SafeConfigParser()
_config.read(['/usr/share/python/debian_defaults',
join(dirname(__file__), '..', 'debian', 'debian_defaults')])
try:
DEFAULT = tuple(int(i) for i in _config.get('DEFAULT',
'default-version')[6:].split('.'))
except:
log.exception('cannot read debian_defaults')
try:
SUPPORTED = tuple(tuple(int(j) for j in i.strip()[6:].split('.'))\
for i in _config.get('DEFAULT',
'supported-versions').split(','))
except:
log.exception('cannot read debian_defaults')
def get_requested_versions(vrange=None, available=None): def get_requested_versions(vrange=None, available=None):
"""Return a set of requested and supported Python versions. """Return a set of requested and supported Python versions.
......
...@@ -38,7 +38,7 @@ NOTES ...@@ -38,7 +38,7 @@ NOTES
In order to support more than one Python version in the same binary package, In order to support more than one Python version in the same binary package,
dh_python2 (unlike dh_pycentral and dh_pysupport) creates symlinks to all dh_python2 (unlike dh_pycentral and dh_pysupport) creates symlinks to all
supported Python versions at build time. It means binNMU (or sourceful upload supported Python versions at build time. It means binNMU (or sourceful upload
in case of architecture independent packages) are required once a list of in case of architecture independent packages) is required once a list of
supported Python version is changed. It's faster and more robust than its supported Python version is changed. It's faster and more robust than its
competitors, though. competitors, though.
......
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