-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.py
63 lines (59 loc) · 2.16 KB
/
setup.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
62
63
import json
import os
import setuptools
import shutil
from pathlib import Path
from setuptools.command.install import install
# Load requirements
with open('requirements.txt') as f:
requirements = f.read().splitlines()
class PostInstallCommand(install):
"""Post-installation for installation mode."""
def run(self):
try:
# cwd is temporary folder
usr_home = Path.home()
cognival_usr_dir = usr_home / '.cognival'
if os.path.exists(cognival_usr_dir):
raise FileExistsError
base = Path('user')
shutil.copy('README.md', (base / 'README.md')),
for path, file_ in [('.', 'README.md'),
('embeddings', 'README.md'),
('cognitive_sources', 'README.md'),
('results', 'README.md'),
('resources', 'cognitive_sources.json'),
('resources', 'demo_config.json'),
('resources', 'embedding_registry.json'),
('resources', 'reference_config.json'),
('resources', 'standard_vocab.txt')
]:
try:
os.makedirs(cognival_usr_dir / path)
except FileExistsError:
pass
shutil.copy((base / path / file_),
(cognival_usr_dir / path / file_))
except FileExistsError:
pass
install.run(self)
setuptools.setup(
name="cognival", # Replace with your own username
version="0.1.4",
author="Multiple authors",
author_email="[email protected]",
description="CogniVal cognitive embedding evaluation",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
scripts=['cognival/cognival'],
install_requires=requirements,
python_requires='>=3.7',
include_package_data=True,
cmdclass={
'install':PostInstallCommand
}
)