forked from cloudfoundry/php-buildpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extension.py
61 lines (48 loc) · 1.43 KB
/
extension.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"""PHPMyAdmin Extension
Downloads, installs and configures PHPMyAdmin
"""
import os
import os.path
import logging
from build_pack_utils import utils
_log = logging.getLogger('phpmyadmin')
DEFAULTS = utils.FormattedDict({
'PHPMYADMIN_VERSION': '4.3.12',
'PHPMYADMIN_PACKAGE': 'phpMyAdmin-{PHPMYADMIN_VERSION}-english.tar.gz',
'PHPMYADMIN_HASH': '707064d1efc37acc8e6fd7ddcc9030616ae32562',
'PHPMYADMIN_URL': 'https://files.phpmyadmin.net/'
'/phpMyAdmin/{PHPMYADMIN_VERSION}/'
'{PHPMYADMIN_PACKAGE}'
})
# Extension Methods
def preprocess_commands(ctx):
return ()
def service_commands(ctx):
return {}
def service_environment(ctx):
return {}
def compile(install):
print 'Installing PHPMyAdmin %s' % DEFAULTS['PHPMYADMIN_VERSION']
ctx = install.builder._ctx
inst = install._installer
workDir = os.path.join(ctx['TMPDIR'], 'phpmyadmin')
inst.install_binary_direct(
DEFAULTS['PHPMYADMIN_URL'],
DEFAULTS['PHPMYADMIN_HASH'],
workDir,
fileName=DEFAULTS['PHPMYADMIN_PACKAGE'],
strip=True)
(install.builder
.move()
.everything()
.under('{BUILD_DIR}/htdocs')
.into(workDir)
.done())
(install.builder
.move()
.everything()
.under(workDir)
.where_name_does_not_match('^%s/setup/.*$' % workDir)
.into('{BUILD_DIR}/htdocs')
.done())
return 0