Commit 1826ce0b authored by Samuel GAIST's avatar Samuel GAIST

[dependencies] Re-implemented bower handling to use it with conda build

parent 95e9cc73
{"directory": "static"}
\ No newline at end of file
{
"name": "beat.web",
"authors": [
"Philip Abbet <philip.abbet@idiap.ch>",
"Andre Anjos <andre.anjos@idiap.ch>",
"Samuel Gaist <samuel.gaist@idiap.ch>",
"Flavio Tarsetti <flavio.tarsetti@idiap.ch>"
],
"description": "BEAT Platform web module",
"main": "",
"keywords": [
"BEAT",
"biometrics"
],
"license": "AGPL",
"homepage": "https://www.beat-eu.org/platform/",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"jquery": "~1.11.3",
"jquery-dateFormat": "~1.0.2",
"jquery-ui": "~1.10.4",
"jquery.cookie": "~1.4.1",
"blueimp-file-upload": "jquery-file-upload#~9.14.0",
"font-awesome": "fontawesome#~4.5.0",
"codemirror": "~5.10.0",
"bootstrap": "~3.3.6",
"bootstrap3-dialog": "~1.34.9",
"bootstrap3-typeahead": "~4.0.0",
"bootstrap-datepicker": "~1.5.1",
"mousetrap": "~1.5.3",
"mustache.js": "mustache#2.3.0",
"raphael": "~2.1.4",
"spectrum": "~1.7.1",
"string_score": "https://github.com/joshaven/string_score.git#~0.1.22",
"chosen-bootstrap": "~1.1.0",
"angular": "angularjs#~1.6.4",
"angular-ui-router": "~0.2.15",
"Chart.js": "chartjs#~1.0.2",
"underscore": "~1.8.3",
"datatables": "~1.10.10",
"angular-ui-sortable": "~0.14",
"angular-ui-codemirror": "^0.3.0"
}
}
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
###############################################################################
# #
# Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# This file is part of the beat.web module of the BEAT platform. #
# #
# Commercial License Usage #
# Licensees holding valid commercial BEAT licenses may use this file in #
# accordance with the terms contained in a written agreement between you #
# and Idiap. For further information contact tto@idiap.ch #
# #
# Alternatively, this file may be used under the terms of the GNU Affero #
# Public License version 3 as published by the Free Software and appearing #
# in the file LICENSE.AGPL included in the packaging of this file. #
# The BEAT platform is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY #
# or FITNESS FOR A PARTICULAR PURPOSE. #
# #
# You should have received a copy of the GNU Affero Public License along #
# with the BEAT platform. If not, see http://www.gnu.org/licenses/. #
# #
###############################################################################
"""\
Execute bower installation
Usage:
%(prog)s [-b <folder> | --base_dir <folder>]
[-x <executable> | --executable <executable>]
[-d <downloads> | --downloads <downloads>]
[-c <command> | --command <command>]
[--config <config_path>]
%(prog)s (-h | --help)
Options:
-h, --help Show this help message
-b <folder>, --base_dir=<folder> The root folder for the
installation procedure
folder [default: base-directory]
-x <executable>, --executable=<executable> The path to the bower executable
executable [default: bower]
-d <downloads>, --downloads=<downloads> Folder where to download the data
downloads [default: downloads]
-c <command>, --command=<command> Command to execute
command [default: install]
--config <config_path> Location of bower.json file
config_path [default: ]
Examples:
To start the installation
$ %(prog)s
A bower.json file must be found in the working folder where the executable
is started
"""
import os
import re
import sys
import json
import docopt
import subprocess
from os import path
from io import open
def main(options):
command = options['--command']
config_path = options['--config']
executable = options['--executable']
base_dir = options['--base_dir']
download_dir = options['--downloads']
if not os.path.exists(base_dir):
os.makedirs(base_dir)
bower_options = '--config.directory=%s' % download_dir
cmd = [executable, bower_options, command]
if command == 'uninstall':
package_dir = path.normpath(path.join(base_dir, download_dir))
cmd += [folder for folder in os.listdir(package_dir)]
else:
if not config_path:
config_path = path.join(path.normpath(path.dirname(__file__)),
'bower.json')
with open(config_path, 'rt') as config_file:
bower_json = json.load(config_file)
dependencies = bower_json.get('dependencies', {})
packages = []
rx = r'^[^\W\d]'
for key, value in dependencies.items():
# If the entry starts by a letter, use only the value in the
# list of packages to install as it is the "correct" name for
# bower to find it.
if re.match(rx, value):
packages.append(value)
else:
packages.append('{}#{}'.format(key, value))
cmd += packages
process = subprocess.Popen(cmd, cwd=base_dir)
process.communicate()
if __name__ == '__main__':
arguments = docopt.docopt(__doc__ %
dict(prog=os.path.basename(sys.argv[0])))
main(arguments)
......@@ -29,31 +29,8 @@ npms = bower protractor
scripts = bower protractor webdriver-manager
[bower]
recipe = bowerrecipe
packages = jquery#~1.11.3
jquery-dateFormat#~1.0.2
jquery-ui#~1.10.4
jquery.cookie#~1.4.1
jquery-file-upload#~9.14.0
fontawesome#~4.5.0
codemirror#~5.10.0
bootstrap#~3.3.6
bootstrap3-dialog#~1.34.9
bootstrap3-typeahead#~4.0.0
bootstrap-datepicker#~1.5.1
mousetrap#~1.5.3
mustache#2.3.0
raphael#~2.1.4
spectrum#~1.7.1
https://github.com/joshaven/string_score.git#~0.1.22
chosen-bootstrap#~1.1.0
angularjs#~1.6.4
angular-ui-router#~0.2.15
chartjs#~1.0.2
underscore#~1.8.3
datatables#~1.10.10
angular-ui-sortable#~0.14
angular-ui-codemirror
executable = ${buildout:bin-directory}/bower
base-directory = beat/web
downloads = static
recipe = collective.recipe.cmd
cmds = ./beat/web/scripts/bower.py -x ${buildout:bin-directory}/bower -b beat/web -d static
uninstall_cmds = ./beat/web/scripts/bower.py -x ${buildout:bin-directory}/bower -b beat/web -d static -c uninstall
on_install = true
on_update = true
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment