-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.bat
More file actions
186 lines (171 loc) · 4.85 KB
/
install.bat
File metadata and controls
186 lines (171 loc) · 4.85 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
@echo off
REM TagManager Installation Script for Windows
REM Supports local and remote (PyPI) installation with automatic upgrades
setlocal enabledelayedexpansion
REM Configuration
set PACKAGE_NAME=tagmanager-cli
set PROJECT_DIR=%~dp0
set DIST_DIR=%PROJECT_DIR%dist
set PYPROJECT_FILE=%PROJECT_DIR%pyproject.toml
REM Check if Python is available
python --version >nul 2>&1
if %errorlevel% neq 0 (
echo ❌ Python is not installed or not in PATH
exit /b 1
)
REM Main logic
if "%1"=="--local" goto local_install
if "%1"=="--remote" goto remote_install
if "%1"=="--help" goto show_help
if "%1"=="-h" goto show_help
if "%1"=="--build-only" goto build_only
if "%1"=="--test-only" goto test_only
echo ❌ No option specified
echo.
goto show_help
:local_install
echo 🚀 TagManager Local Installation
echo ================================
echo.
echo ⚙️ Installing build tools...
python -m pip install --upgrade pip build twine
echo.
echo ⚙️ Building package...
if exist "%DIST_DIR%" rmdir /s /q "%DIST_DIR%"
python -m build
if %errorlevel% neq 0 (
echo ❌ Package build failed
exit /b 1
)
echo.
echo ⚙️ Installing package locally...
python -m pip uninstall %PACKAGE_NAME% -y >nul 2>&1
for %%f in ("%DIST_DIR%\*.whl") do (
python -m pip install "%%f"
if !errorlevel! equ 0 (
echo ✅ Package installed locally
goto test_install
) else (
echo ❌ Local installation failed
exit /b 1
)
)
echo ❌ No wheel file found
exit /b 1
:remote_install
echo 🚀 TagManager Remote Installation (PyPI)
echo ========================================
echo.
echo ⚙️ Installing build tools...
python -m pip install --upgrade pip build twine
echo.
echo ⚙️ Building package...
if exist "%DIST_DIR%" rmdir /s /q "%DIST_DIR%"
python -m build
if %errorlevel% neq 0 (
echo ❌ Package build failed
exit /b 1
)
echo.
echo ⚙️ Publishing to PyPI...
echo ⚠️ Make sure you have PyPI credentials configured
twine upload "%DIST_DIR%\*"
if %errorlevel% neq 0 (
echo ⚠️ PyPI upload failed, installing locally instead
goto local_install_fallback
)
echo.
echo ⚙️ Waiting for PyPI to process...
timeout /t 30 /nobreak >nul
echo.
echo ⚙️ Installing from PyPI...
python -m pip uninstall %PACKAGE_NAME% -y >nul 2>&1
python -m pip install --upgrade %PACKAGE_NAME%
if %errorlevel% equ 0 (
echo ✅ Package installed from PyPI
goto test_install
) else (
echo ❌ PyPI installation failed
exit /b 1
)
:local_install_fallback
echo ⚙️ Installing package locally (fallback)...
python -m pip uninstall %PACKAGE_NAME% -y >nul 2>&1
for %%f in ("%DIST_DIR%\*.whl") do (
python -m pip install "%%f"
goto test_install
)
:build_only
echo 🚀 TagManager Build Only
echo =======================
echo.
echo ⚙️ Installing build tools...
python -m pip install --upgrade pip build twine
echo.
echo ⚙️ Building package...
if exist "%DIST_DIR%" rmdir /s /q "%DIST_DIR%"
python -m build
if %errorlevel% equ 0 (
echo ✅ Build complete. Files in: %DIST_DIR%
dir "%DIST_DIR%"
) else (
echo ❌ Package build failed
exit /b 1
)
goto end
:test_only
goto test_install
:test_install
echo.
echo ⚙️ Testing installation...
tm --help >nul 2>&1
if %errorlevel% equ 0 (
echo ✅ Command 'tm' is available
) else (
echo ❌ Command 'tm' not found
exit /b 1
)
tagmanager --help >nul 2>&1
if %errorlevel% equ 0 (
echo ✅ Command 'tagmanager' is available
) else (
echo ⚠️ Command 'tagmanager' not found (but tm works)
)
echo.
echo ✨ Installation Complete! ✨
echo ================================
echo Package: %PACKAGE_NAME%
echo Commands: tm, tagmanager
echo.
echo Quick Start:
echo tm --help # Show all commands
echo tm add file.txt --tags work # Add tags to file
echo tm search --tags work # Search by tags
echo tm ls --tree # Tree view
echo tm stats --chart # Statistics
echo.
echo Next Steps:
echo • Read the documentation: README.md
echo • Check installation guide: INSTALLATION.md
echo • Start tagging your files!
echo ================================
goto end
:show_help
echo Usage:
echo install.bat --local Install package locally from source
echo install.bat --remote Publish to PyPI and install from there
echo install.bat --help Show this help message
echo.
echo Options:
echo --local Build and install package locally
echo --remote Build, publish to PyPI, then install from PyPI
echo --build-only Build package without installing
echo --test-only Test existing installation
echo --help Show this help message
echo.
echo Examples:
echo install.bat --local # Quick local install
echo install.bat --remote # Publish and install
echo python bump_version.py patch ^&^& install.bat --remote # Bump and publish
:end
pause