aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/coredata.py6
-rw-r--r--mesonbuild/scripts/meson_install.py3
-rwxr-xr-xrun_unittests.py6
-rw-r--r--test cases/java/1 basic/installed_files.txt1
-rw-r--r--test cases/java/1 basic/meson.build4
5 files changed, 17 insertions, 3 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 7b4059e..954e497 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -13,6 +13,7 @@
# limitations under the License.
import pickle, os, uuid
+from pathlib import PurePath
from .mesonlib import MesonException, commonpath
from .mesonlib import default_libdir, default_libexecdir, default_prefix
@@ -159,7 +160,10 @@ class CoreData:
if option.endswith('dir') and os.path.isabs(value) and \
option not in builtin_dir_noprefix_options:
# Value must be a subdir of the prefix
- if commonpath([value, prefix]) != prefix:
+ # commonpath will always return a path in the native format, so we
+ # must use pathlib.PurePath to do the same conversion before
+ # comparing.
+ if commonpath([value, prefix]) != str(PurePath(prefix)):
m = 'The value of the {!r} option is {!r} which must be a ' \
'subdir of the prefix {!r}.\nNote that if you pass a ' \
'relative path, it is assumed to be a subdir of prefix.'
diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/scripts/meson_install.py
index a74573e..2ffc505 100644
--- a/mesonbuild/scripts/meson_install.py
+++ b/mesonbuild/scripts/meson_install.py
@@ -237,6 +237,9 @@ def install_targets(d):
elif os.path.isfile(fname):
do_copyfile(fname, outname)
if should_strip:
+ if fname.endswith('.jar'):
+ print('Not stripping jar target:', os.path.split(fname)[1])
+ continue
print('Stripping target {!r}'.format(fname))
ps, stdo, stde = Popen_safe(['strip', outname])
if ps.returncode != 0:
diff --git a/run_unittests.py b/run_unittests.py
index e8659f4..aed1412 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -15,10 +15,11 @@
import stat
import shlex
-import unittest, os, sys, shutil, time
import subprocess
import re, json
import tempfile
+import pathlib
+import unittest, os, sys, shutil, time
from glob import glob
import mesonbuild.compilers
import mesonbuild.environment
@@ -169,6 +170,9 @@ class InternalTests(unittest.TestCase):
self.assertEqual(commonpath(['/usr', '/bin']), sep)
self.assertEqual(commonpath(['/usr', 'bin']), '')
self.assertEqual(commonpath(['blam', 'bin']), '')
+ prefix = '/some/path/to/prefix'
+ libdir = '/some/path/to/prefix/libdir'
+ self.assertEqual(commonpath([prefix, libdir]), str(pathlib.PurePath(prefix)))
class LinuxlikeTests(unittest.TestCase):
diff --git a/test cases/java/1 basic/installed_files.txt b/test cases/java/1 basic/installed_files.txt
new file mode 100644
index 0000000..1c7cede
--- /dev/null
+++ b/test cases/java/1 basic/installed_files.txt
@@ -0,0 +1 @@
+usr/bin/myprog.jar
diff --git a/test cases/java/1 basic/meson.build b/test cases/java/1 basic/meson.build
index bed5c0f..201a609 100644
--- a/test cases/java/1 basic/meson.build
+++ b/test cases/java/1 basic/meson.build
@@ -1,5 +1,7 @@
project('simplejava', 'java')
javaprog = jar('myprog', 'com/mesonbuild/Simple.java',
- main_class : 'com.mesonbuild.Simple')
+ main_class : 'com.mesonbuild.Simple',
+ install : true,
+ install_dir : get_option('bindir'))
test('mytest', javaprog)