aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2015-01-06 00:18:03 +0000
committerlloyd <[email protected]>2015-01-06 00:18:03 +0000
commit6198946dbb5a864ab0aa9ce8d27c920423634827 (patch)
treeda3da2f34b696994dfb786b2b1bc01628613ea70
parent21e038b98b9d0ddc26bff65b078a7d5adee440ef (diff)
Fix install script under Python3
-rw-r--r--doc/relnotes/1_11_13.rst7
-rw-r--r--src/build-data/botan.pc.in2
-rwxr-xr-xsrc/scripts/combine_relnotes.py19
-rwxr-xr-xsrc/scripts/install.py22
4 files changed, 35 insertions, 15 deletions
diff --git a/doc/relnotes/1_11_13.rst b/doc/relnotes/1_11_13.rst
index b73b01633..3be7bff70 100644
--- a/doc/relnotes/1_11_13.rst
+++ b/doc/relnotes/1_11_13.rst
@@ -7,5 +7,8 @@ Version 1.11.13, Not Yet Released
* Add DTLS-SRTP negotiation defined in RFC 5764
-* The Python install script in version 1.11.10 failed to place the
- headers into a versioned subdirectory.
+* The Python install script added in version 1.11.10 failed to place
+ the headers into a versioned subdirectory.
+
+* Fix the install script when running under Python3.
+
diff --git a/src/build-data/botan.pc.in b/src/build-data/botan.pc.in
index 301f84600..49d7cfb59 100644
--- a/src/build-data/botan.pc.in
+++ b/src/build-data/botan.pc.in
@@ -4,7 +4,7 @@ libdir=${prefix}/%{libdir}
includedir=${prefix}/include/botan-%{version_major}.%{version_minor}
Name: Botan
-Description: Multi-platform C++ crypto library
+Description: Crypto and TLS for C++11
Version: %{version}
Libs: -L${libdir} -lbotan-%{version_major}.%{version_minor}
diff --git a/src/scripts/combine_relnotes.py b/src/scripts/combine_relnotes.py
index c843bf347..9b6c4f304 100755
--- a/src/scripts/combine_relnotes.py
+++ b/src/scripts/combine_relnotes.py
@@ -9,6 +9,13 @@ Distributed under the terms of the Botan license
import re
import sys
import os
+import sys
+
+def open_for_utf8(fsname, mode):
+ if sys.version_info[0] == 3:
+ return open(fsname, mode, encoding='utf-8')
+ else:
+ return open(fsname, mode)
def combine_relnotes(relnote_dir, with_rst_labels):
@@ -23,7 +30,7 @@ def combine_relnotes(relnote_dir, with_rst_labels):
versions_nyr = []
for f in relnotes:
- contents = open(os.path.join(relnote_dir, f)).readlines()
+ contents = open_for_utf8(os.path.join(relnote_dir, f), 'r').readlines()
match = re_version.match(contents[0])
@@ -33,13 +40,13 @@ def combine_relnotes(relnote_dir, with_rst_labels):
versions.append(version)
version_date[version] = date
else:
- match = re_nyr.match(contents[0])
- version = match.group(1)
-
- versions_nyr.append(version)
+ match = re_nyr.match(str(contents[0]))
if not match:
raise Exception('No version match for %s' % (f))
+ version = match.group(1)
+ versions_nyr.append(version)
+
version_contents[version] = (''.join(contents)).strip()
def make_label(v):
@@ -76,7 +83,7 @@ def main(args = None):
if args is None:
args = sys.argv
- print combine_relnotes(args[1], True)
+ print(combine_relnotes(args[1], True))
if __name__ == '__main__':
sys.exit(main())
diff --git a/src/scripts/install.py b/src/scripts/install.py
index 82b1155b7..daa4a928e 100755
--- a/src/scripts/install.py
+++ b/src/scripts/install.py
@@ -1,4 +1,11 @@
-#!/usr/bin/env python2
+#!/usr/bin/python
+
+"""
+Botan install script
+(C) 2014,2015 Jack Lloyd
+
+Distributed under the terms of the Botan license
+"""
import errno
import logging
@@ -8,6 +15,9 @@ import shutil
import string
import sys
+if 'dont_write_bytecode' in sys.__dict__:
+ sys.dont_write_bytecode = True
+
from botan_version import release_major, release_minor
import combine_relnotes
@@ -26,7 +36,7 @@ def parse_command_line(args):
parser.add_option_group(build_group)
install_group = optparse.OptionGroup(parser, 'Installation options')
- install_group.add_option('--destdir', default='/tmp/local',
+ install_group.add_option('--destdir', default='/usr/local',
help='Set output directory (default %default)')
install_group.add_option('--bindir', default='bin', metavar='DIR',
help='Set binary subdir (default %default)')
@@ -94,13 +104,13 @@ def main(args = None):
(options, args) = parse_command_line(args)
- exe_mode = 0777
+ exe_mode = 0o777
if 'umask' in os.__dict__:
umask = int(options.umask, 8)
logging.debug('Setting umask to %s' % oct(umask))
os.umask(int(options.umask, 8))
- exe_mode &= (umask ^ 0777)
+ exe_mode &= (umask ^ 0o777)
def copy_executable(src, dest):
shutil.copyfile(src, dest)
@@ -195,7 +205,7 @@ def main(args = None):
with open(os.path.join(botan_doc_dir, 'license.txt'), 'w+') as lic:
lic.write(license_text('doc/license.rst'))
- with open(os.path.join(botan_doc_dir, 'news.txt'), 'w+') as news:
+ with combine_relnotes.open_for_utf8(os.path.join(botan_doc_dir, 'news.txt'), 'w+') as news:
news.write(combine_relnotes.combine_relnotes('doc/relnotes', False))
logging.info('Botan %s installation complete', build_vars['version'])
@@ -206,5 +216,5 @@ if __name__ == '__main__':
except Exception as e:
logging.error('Failure: %s' % (e))
import traceback
- logging.debug(traceback.format_exc())
+ logging.info(traceback.format_exc())
sys.exit(1)