forked from OnroerendErfgoed/atramhasis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
158 lines (142 loc) · 5.52 KB
/
Copy pathsetup.py
File metadata and controls
158 lines (142 loc) · 5.52 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
import os
import distutils.file_util as file_util
import distutils.dir_util as dir_util
import subprocess
from setuptools import setup, find_packages, Command
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.rst')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.rst')) as f:
CHANGES = f.read()
def copy_files_scaffolds(filename, new_filename, output_dir):
source_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), filename))
dest_dir = os.path.join(os.path.dirname(__file__), 'atramhasis', 'scaffolds', output_dir, new_filename + '_tmpl')
file_util.copy_file(source_dir, dest_dir, update=True)
def copy_static_scaffold(output_dir):
source_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'atramhasis', 'static'))
dest_dir = os.path.join(os.path.dirname(__file__), 'atramhasis', 'scaffolds', output_dir, '+package+', 'static')
dir_util.copy_tree(os.path.join(source_dir, 'css'), os.path.join(dest_dir, 'css'), update=True)
dir_util.copy_tree(os.path.join(source_dir, 'img'), os.path.join(dest_dir, 'img'), update=True)
dir_util.copy_tree(os.path.join(source_dir, 'js'), os.path.join(dest_dir, 'js'), update=True)
dir_util.copy_tree(os.path.join(source_dir, 'scss', 'atramhasis'), os.path.join(dest_dir, 'scss', 'atramhasis'),
update=True)
dir_util.mkpath(os.path.join(dest_dir, 'admin'))
file_util.copy_file(
os.path.join(source_dir, 'admin', '.bowerrc'),
os.path.join(dest_dir, 'admin', '.bowerrc'),
update=True
)
file_util.copy_file(
os.path.join(source_dir, 'admin', 'bower.json'),
os.path.join(dest_dir, 'admin', 'bower.json'),
update=True
)
file_util.copy_file(
os.path.join(source_dir, 'admin', 'Gruntfile.js'),
os.path.join(dest_dir, 'admin', 'Gruntfile.js'),
update=True
)
file_util.copy_file(
os.path.join(source_dir, 'admin', 'package.json'),
os.path.join(dest_dir, 'admin', 'package.json'),
update=True
)
def dojo_build():
print('-' * 50)
print('==> check npm dependencies')
libs = str(subprocess.check_output(["npm", "list", "-g", "bower", "grunt-cli"]))
if 'bower' in libs:
bower = True
print('bower OK')
else:
bower = False
print('bower KO, use \'npm install -g bower\' to install')
if 'grunt-cli' in libs:
gruntcli = True
print('grunt-cli OK')
else:
gruntcli = False
print('grunt-cli KO, use \'npm install -g grunt-cli\' to install')
if bower and gruntcli:
print('==> running grunt build')
subprocess.call(["grunt", "-v", "build"], cwd="atramhasis/static/admin")
print('-' * 50)
class PrepareScaffold(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
dojo_build()
copy_files_scaffolds("requirements.txt", "atramhasis-requirements.txt", "atramhasis_demo")
copy_files_scaffolds("requirements-dev-base.txt", "atramhasis-requirements-dev.txt", "atramhasis_demo")
copy_files_scaffolds("requirements.txt", "atramhasis-requirements.txt", "atramhasis_scaffold")
copy_files_scaffolds("requirements-dev-base.txt", "atramhasis-requirements-dev.txt", "atramhasis_scaffold")
copy_static_scaffold("atramhasis_scaffold")
copy_static_scaffold("atramhasis_demo")
requires = [
'pyramid',
'pyramid_tm',
'SQLAlchemy',
'transaction',
'zope.sqlalchemy',
'waitress',
'skosprovider',
'skosprovider_sqlalchemy',
'skosprovider_rdf',
'skosprovider_getty',
'skosprovider_heritagedata',
'pyramid_skosprovider',
'language_tags',
'pyramid_jinja2',
'alembic',
'babel',
'colander',
'requests',
'dogpile.cache',
'six',
'pyramid_rewrite'
]
setup(name='atramhasis',
version='0.6.7',
description='A web based editor for thesauri adhering to the SKOS specification.',
long_description=README + '\n\n' + CHANGES,
classifiers=[
"Development Status :: 4 - Beta",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python",
"Framework :: Pyramid",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6"
],
author='Flanders Heritage Agency',
author_email='ict@onroerenderfgoed.be',
url='http://atramhasis.readthedocs.org',
keywords='web wsgi pyramid SKOS thesaurus vocabulary',
license='GPLv3',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
test_suite='atramhasis',
install_requires=requires,
entry_points="""\
[paste.app_factory]
main = atramhasis:main
[console_scripts]
initialize_atramhasis_db = atramhasis.scripts.initializedb:main
import_file = atramhasis.scripts.import_file:main
dump_rdf = atramhasis.scripts.dump_rdf:main
generate_ldf_config = atramhasis.scripts.generate_ldf_config:main
[pyramid.scaffold]
atramhasis_scaffold=atramhasis.scaffolds:AtramhasisTemplate
atramhasis_demo=atramhasis.scaffolds:AtramhasisDemoTemplate
""",
cmdclass={
'prepare': PrepareScaffold
}
)