aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-07-21 16:51:12 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2019-07-23 23:26:46 +0300
commit7ce2a24f42ce546ad7b26594b3c9b3f087d83f94 (patch)
tree38db88b243db481141b8e73a33d76ba29c74a9c3
parent381110143493ef12b62e79931002cc77dd47a182 (diff)
downloadmeson-7ce2a24f42ce546ad7b26594b3c9b3f087d83f94.zip
meson-7ce2a24f42ce546ad7b26594b3c9b3f087d83f94.tar.gz
meson-7ce2a24f42ce546ad7b26594b3c9b3f087d83f94.tar.bz2
Made dist a top level command.
-rw-r--r--mesonbuild/backend/ninjabackend.py6
-rw-r--r--mesonbuild/mdist.py (renamed from mesonbuild/scripts/dist.py)23
-rw-r--r--mesonbuild/mesonmain.py4
3 files changed, 15 insertions, 18 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index cc601d8..570a153 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -2645,11 +2645,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
def generate_dist(self):
elem = NinjaBuildElement(self.all_outputs, 'meson-dist', 'CUSTOM_COMMAND', 'PHONY')
elem.add_item('DESC', 'Creating source packages')
- elem.add_item('COMMAND', self.environment.get_build_command() + [
- '--internal', 'dist',
- self.environment.source_dir,
- self.environment.build_dir,
- ] + self.environment.get_build_command())
+ elem.add_item('COMMAND', self.environment.get_build_command() + ['dist'])
elem.add_item('pool', 'console')
self.add_build(elem)
# Alias that runs the target defined above
diff --git a/mesonbuild/scripts/dist.py b/mesonbuild/mdist.py
index e697890..d1dee1b 100644
--- a/mesonbuild/scripts/dist.py
+++ b/mesonbuild/mdist.py
@@ -24,7 +24,7 @@ import tarfile, zipfile
from glob import glob
from mesonbuild.environment import detect_ninja
from mesonbuild.mesonlib import windows_proof_rmtree
-from mesonbuild import mlog
+from mesonbuild import mlog, build
def create_hash(fname):
hashname = fname + '.sha256sum'
@@ -178,24 +178,23 @@ def check_dist(packagename, meson_command, privdir):
print('Distribution package %s tested' % packagename)
return 0
-def run(args):
- src_root = args[0]
- bld_root = args[1]
- meson_command = args[2:]
+def run(opts):
+ b = build.load('.')
+ # This import must be load delayed, otherwise it will get the default
+ # value of None.
+ from mesonbuild.mesonlib import meson_command
+ src_root = b.environment.source_dir
+ bld_root = b.environment.build_dir
priv_dir = os.path.join(bld_root, 'meson-private')
dist_sub = os.path.join(bld_root, 'meson-dist')
- buildfile = os.path.join(priv_dir, 'build.dat')
-
- build = pickle.load(open(buildfile, 'rb'))
-
- dist_name = build.project_name + '-' + build.project_version
+ dist_name = b.project_name + '-' + b.project_version
_git = os.path.join(src_root, '.git')
if os.path.isdir(_git) or os.path.isfile(_git):
- names = create_dist_git(dist_name, src_root, bld_root, dist_sub, build.dist_scripts)
+ names = create_dist_git(dist_name, src_root, bld_root, dist_sub, b.dist_scripts)
elif os.path.isdir(os.path.join(src_root, '.hg')):
- names = create_dist_hg(dist_name, src_root, bld_root, dist_sub, build.dist_scripts)
+ names = create_dist_hg(dist_name, src_root, bld_root, dist_sub, b.dist_scripts)
else:
print('Dist currently only works with Git or Mercurial repos')
return 1
diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py
index c94f1bf..c89465c 100644
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -22,7 +22,7 @@ import shutil
from . import mesonlib
from . import mlog
-from . import mconf, minit, minstall, mintro, msetup, mtest, rewriter, msubprojects, munstable_coredata
+from . import mconf, mdist, minit, minstall, mintro, msetup, mtest, rewriter, msubprojects, munstable_coredata
from .mesonlib import MesonException
from .environment import detect_msys2_arch
from .wrap import wraptool
@@ -44,6 +44,8 @@ class CommandLineParser:
help_msg='Configure the project')
self.add_command('configure', mconf.add_arguments, mconf.run,
help_msg='Change project options',)
+ self.add_command('dist', mconf.add_arguments, mdist.run,
+ help_msg='Generate release archive',)
self.add_command('install', minstall.add_arguments, minstall.run,
help_msg='Install the project')
self.add_command('introspect', mintro.add_arguments, mintro.run,