-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathsetup.py
More file actions
76 lines (65 loc) · 2.46 KB
/
Copy pathsetup.py
File metadata and controls
76 lines (65 loc) · 2.46 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
from pathlib import Path
import os
import subprocess
import sys
import setuptools
def build_frontend():
"""Build the Vue frontend during installation."""
frontend_dir = Path(__file__).parent / "streamlit_pdf_viewer" / "frontend"
dist_dir = frontend_dir / "dist"
if not frontend_dir.exists():
print("Frontend directory not found, skipping build")
return
# Check if dist directory exists and contains built files
if dist_dir.exists() and any(dist_dir.iterdir()):
print("Frontend already built, skipping build step")
return
print("Building Vue frontend...")
# Check if npm is available
try:
subprocess.run(["npm", "--version"], check=True, capture_output=True)
except (subprocess.CalledProcessError, FileNotFoundError):
print("npm not found. Please install Node.js and npm to build the frontend.")
return
# Install dependencies
try:
subprocess.run(["npm", "install"], cwd=frontend_dir, check=True)
print("npm dependencies installed successfully")
except subprocess.CalledProcessError as e:
print(f"Failed to install npm dependencies: {e}")
return
# Build the frontend
try:
subprocess.run(["npm", "run", "build"], cwd=frontend_dir, check=True)
print("Vue frontend built successfully")
except subprocess.CalledProcessError as e:
print(f"Failed to build Vue frontend: {e}")
return
# Build frontend during installation
build_frontend()
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
bump_version = (this_directory / ".bumpversion.toml").read_text()
current_version_line = [line for line in bump_version.split('\n') if 'current_version' in line][0]
version = current_version_line.split('=')[1].strip().strip('"')
setuptools.setup(
name="streamlit-pdf-viewer",
version=version,
author="Luca Foppiano, Tomoya Mato",
author_email="lucanoro@duck.com, tomoya.matou@gmail.com",
description="Streamlit component for PDF visualisation and manipulation",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/lfoppiano/streamlit-pdf-viewer",
packages=setuptools.find_packages(),
include_package_data=True,
python_requires=">=3.7",
install_requires=[
"streamlit >= 0.63"
],
extras_require={
"devel": [
"wheel"
]
}
)