Made dist a top level command.

pull/5700/head
Jussi Pakkanen 5 years ago
parent 3811101434
commit 7ce2a24f42
  1. 6
      mesonbuild/backend/ninjabackend.py
  2. 23
      mesonbuild/mdist.py
  3. 4
      mesonbuild/mesonmain.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

@ -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

@ -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,

Loading…
Cancel
Save