assume_yes = False
nightly = False
ssh_key = False
+nightly_version = None
def print_err(msg):
"""
def add_libs(rel_name, galette_archive):
"""
Add external libraries to the archive
+ Also write version for GALETTE_NIGHTLY value
"""
galette = tarfile.open(galette_archive, 'r|bz2')
src_dir = os.path.join(local_dl_repo, 'src')
galette.extractall(path=src_dir)
galette.close()
+ #set galette nightly version
+ includes_dir = os.path.join(src_dir, rel_name, 'galette', 'includes')
+ sed_cmd = 'sed -e "s/GALETTE_NIGHTLY\', false/GALETTE_NIGHTLY\', \'%s\'/" -i galette.inc.php' % nightly_version
+ print(sed_cmd)
+ p1 = subprocess.Popen(sed_cmd, shell=True, cwd=includes_dir)
+ p1.wait()
+
+ #install npm modules
npm_dir = os.path.join(src_dir, rel_name)
npm_cmd = 'npm install --prefix %s' % npm_dir
print(npm_cmd)
p1 = subprocess.Popen(npm_cmd, shell=True, cwd=npm_dir)
p1.wait()
+ #run gulp install script for assets
wp_cmd = 'npm run-script gulp build'
p1 = subprocess.Popen(wp_cmd, shell=True, cwd=npm_dir)
p1.wait()
+ #node modules are no longer needed
shutil.rmtree(os.path.join(npm_dir, 'node_modules'))
+ #install php dependencies
composer_cmd = 'composer install --no-dev'
composer_dir = os.path.join(src_dir, rel_name, 'galette')
print(composer_dir)
def valid_commit(repo, c):
"""
Validate commit existance in repository
+ Also prepare version for GALETTE_NIGHTLY value
"""
- global commit
+ global commit, nightly_version
try:
dformat = '%a, %d %b %Y %H:%M'
repo_commit = repo.commit(c)
commit = repo_commit.hexsha[:10]
+
+ nightly_version = '%s (%s)' % (
+ commit,
+ time.strftime('%Y-%m-%d %H:%M:%S GMT%z', time.localtime(repo_commit.authored_date)),
+ )
+
print(colored("""Commit information:
Hash: %s
Author: %s