-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
60 lines (52 loc) · 1.72 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
import atexit
import datetime
import os
import setuptools
import shutil
import site
import sys
sys.path.insert(0, ".")
from microlog import sitecustomize
pip = f"{sys.executable} -m pip install -r requirements.txt"
os.system(pip)
def _post_install():
sitepackages = site.getsitepackages()[0]
original = sitecustomize.__file__
target = os.path.join(sitepackages, os.path.basename(original))
if os.path.exists(target):
with open(target) as file:
if "Microlog" in file.read():
print("Microlog was already installed in", target)
return
with open(target, "a") as file:
file.write("#\n")
file.write(f"# Microlog installation time: {datetime.datetime.now()}\n")
file.write(f"# Microlog location: {original}\n")
file.write(open(sitecustomize.__file__).read())
else:
shutil.copy(sitecustomize.__file__, sitepackages)
print('Microlog has been installed', sitecustomize.__file__, "into", target)
atexit.register(_post_install)
from pathlib import Path
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
setuptools.setup(
name='Microlog',
description='A continuous profiler and logger for Python',
long_description=long_description,
long_description_content_type='text/markdown',
version="1.3.35",
zip_safe=False,
author='Chris Laffra',
author_email='laffra@gmail.com',
url='https://www.chrislaffra.org/',
packages=setuptools.find_packages(include=[
'microlog',
'dashboard',
]),
include_package_data=True,
package_data={
"microlog": ["*.png", "*.html"],
"dashboard": ["*.png", "*.html"],
}
)