pucit 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pucit-0.1.0/.github/workflows/ci.yml +38 -0
- pucit-0.1.0/.github/workflows/publish.yml +37 -0
- pucit-0.1.0/.gitignore +33 -0
- pucit-0.1.0/LICENSE.txt +21 -0
- pucit-0.1.0/PKG-INFO +134 -0
- pucit-0.1.0/README.md +100 -0
- pucit-0.1.0/pyproject.toml +57 -0
- pucit-0.1.0/src/pucit/__about__.py +1 -0
- pucit-0.1.0/src/pucit/__init__.py +3 -0
- pucit-0.1.0/src/pucit/__main__.py +4 -0
- pucit-0.1.0/src/pucit/cli.py +258 -0
- pucit-0.1.0/src/pucit/commands/__init__.py +1 -0
- pucit-0.1.0/src/pucit/commands/bypass.py +55 -0
- pucit-0.1.0/src/pucit/commands/doctor.py +80 -0
- pucit-0.1.0/src/pucit/commands/install.py +83 -0
- pucit-0.1.0/src/pucit/commands/oracle.py +176 -0
- pucit-0.1.0/src/pucit/commands/scaffold.py +71 -0
- pucit-0.1.0/src/pucit/config.py +45 -0
- pucit-0.1.0/src/pucit/cpp_build.py +214 -0
- pucit-0.1.0/src/pucit/docker_util.py +146 -0
- pucit-0.1.0/src/pucit/platform/__init__.py +5 -0
- pucit-0.1.0/src/pucit/platform/packages.py +89 -0
- pucit-0.1.0/src/pucit/util.py +114 -0
- pucit-0.1.0/tests/__init__.py +0 -0
- pucit-0.1.0/tests/test_cli.py +26 -0
- pucit-0.1.0/tests/test_cpp_build.py +38 -0
- pucit-0.1.0/tests/test_oracle.py +21 -0
- pucit-0.1.0/tests/test_scaffold_bypass.py +33 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: test (${{ matrix.os }}, py${{ matrix.python-version }})
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
os: [ubuntu-latest, windows-latest]
|
|
17
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: ${{ matrix.python-version }}
|
|
26
|
+
|
|
27
|
+
- name: Install package
|
|
28
|
+
run: python -m pip install -e ".[dev]"
|
|
29
|
+
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: pytest -q
|
|
32
|
+
|
|
33
|
+
- name: CLI smoke
|
|
34
|
+
shell: bash
|
|
35
|
+
run: |
|
|
36
|
+
pucit version
|
|
37
|
+
pucit --help
|
|
38
|
+
pucit doctor
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish:
|
|
13
|
+
name: publish
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
environment:
|
|
16
|
+
name: pypi
|
|
17
|
+
url: https://pypi.org/p/pucit
|
|
18
|
+
permissions:
|
|
19
|
+
id-token: write
|
|
20
|
+
contents: read
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- name: Set up Python
|
|
26
|
+
uses: actions/setup-python@v5
|
|
27
|
+
with:
|
|
28
|
+
python-version: "3.12"
|
|
29
|
+
|
|
30
|
+
- name: Install build tools
|
|
31
|
+
run: python -m pip install --upgrade pip build
|
|
32
|
+
|
|
33
|
+
- name: Build sdist and wheel
|
|
34
|
+
run: python -m build
|
|
35
|
+
|
|
36
|
+
- name: Publish to PyPI
|
|
37
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
pucit-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Byte-compiled / cache
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
.pytest_cache/
|
|
8
|
+
.mypy_cache/
|
|
9
|
+
.ruff_cache/
|
|
10
|
+
.coverage
|
|
11
|
+
htmlcov/
|
|
12
|
+
.tox/
|
|
13
|
+
.nox/
|
|
14
|
+
|
|
15
|
+
# Packaging / envs
|
|
16
|
+
build/
|
|
17
|
+
dist/
|
|
18
|
+
*.egg-info/
|
|
19
|
+
.eggs/
|
|
20
|
+
.venv/
|
|
21
|
+
venv/
|
|
22
|
+
env/
|
|
23
|
+
|
|
24
|
+
# IDE / OS
|
|
25
|
+
.idea/
|
|
26
|
+
.vscode/
|
|
27
|
+
*.swp
|
|
28
|
+
.DS_Store
|
|
29
|
+
Thumbs.db
|
|
30
|
+
|
|
31
|
+
# Local tooling
|
|
32
|
+
*.log
|
|
33
|
+
.pucit/
|
pucit-0.1.0/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mudassir Ashraf
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
pucit-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: pucit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: PUCIT student toolkit CLI — Oracle, PF/C++, campus bypass, and ease-of-use commands
|
|
5
|
+
Project-URL: Documentation, https://github.com/mudassir-cpp/pucit#readme
|
|
6
|
+
Project-URL: Issues, https://github.com/mudassir-cpp/pucit/issues
|
|
7
|
+
Project-URL: Source, https://github.com/mudassir-cpp/pucit
|
|
8
|
+
Author-email: MIZI <gem920se@gmail.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE.txt
|
|
11
|
+
Keywords: PUCIT,bypass,cpp,docker,g++,oracle,pucit
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Education
|
|
15
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
25
|
+
Classifier: Topic :: Education
|
|
26
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
27
|
+
Requires-Python: >=3.8
|
|
28
|
+
Requires-Dist: bypass-pucit>=0.0.2
|
|
29
|
+
Requires-Dist: rich>=13.0.0
|
|
30
|
+
Requires-Dist: typer>=0.12.0
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# pucit
|
|
36
|
+
|
|
37
|
+
PUCIT student toolkit CLI — install Oracle (Docker), set up PF/C++ essentials, campus proxy bypass, and compile/run lab code in one command.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install pucit
|
|
41
|
+
# or from source:
|
|
42
|
+
pip install -e ".[dev]"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Quick start
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pucit doctor
|
|
49
|
+
pucit install pf
|
|
50
|
+
pucit run main.cpp
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Commands
|
|
54
|
+
|
|
55
|
+
### C++ labs (ease)
|
|
56
|
+
|
|
57
|
+
| Command | What it does |
|
|
58
|
+
|---|---|
|
|
59
|
+
| `pucit run main.cpp` | Compile with `g++` into `build/`, then run — no `./a.out` |
|
|
60
|
+
| `pucit compile main.cpp` | Compile only |
|
|
61
|
+
| `pucit debug main.cpp` | Compile with `-g` and open `gdb` |
|
|
62
|
+
| `pucit watch main.cpp` | Recompile + run on save |
|
|
63
|
+
| `pucit clean` | Remove `build/` and `a.out` |
|
|
64
|
+
| `pucit new hello` | Create `hello.cpp` from template |
|
|
65
|
+
| `pucit init` | Scaffold `main.cpp` + `Makefile` + `.gitignore` |
|
|
66
|
+
|
|
67
|
+
Extras:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pucit run main.cpp util.cpp
|
|
71
|
+
pucit run main.cpp -f "-O2 -std=c++20"
|
|
72
|
+
pucit run main.cpp -i input.txt
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Oracle (Docker)
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pucit install oracle
|
|
79
|
+
pucit start oracle
|
|
80
|
+
pucit stop oracle
|
|
81
|
+
pucit status oracle
|
|
82
|
+
pucit logs oracle
|
|
83
|
+
pucit oracle connect
|
|
84
|
+
pucit oracle rm
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Uses Oracle Database Free image `container-registry.oracle.com/database/free:latest` as container `pucit-oracle` on port `1521`. Password is saved under `~/.config/pucit/oracle.env`.
|
|
88
|
+
|
|
89
|
+
If pull fails with auth errors, accept the license on [Oracle Container Registry](https://container-registry.oracle.com/), then `docker login container-registry.oracle.com` and retry.
|
|
90
|
+
|
|
91
|
+
### Tooling / campus net
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pucit install pf # g++, make, gdb, cmake
|
|
95
|
+
pucit install docker
|
|
96
|
+
pucit install sqlclient # Instant Client / sqlplus guidance
|
|
97
|
+
pucit bypass set # wraps bypass-pucit
|
|
98
|
+
pucit bypass unset
|
|
99
|
+
pucit doctor
|
|
100
|
+
pucit list
|
|
101
|
+
pucit which g++
|
|
102
|
+
pucit open .
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Supported OS
|
|
106
|
+
|
|
107
|
+
Linux (dnf/apt/…) and Windows (winget/choco) for installers. `run` / `compile` work anywhere `g++` or `clang++` is available.
|
|
108
|
+
|
|
109
|
+
## Development / CI
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
pip install -e ".[dev]"
|
|
113
|
+
pytest -q
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
GitHub Actions:
|
|
117
|
+
|
|
118
|
+
- **CI** (`.github/workflows/ci.yml`) — tests on Linux + Windows for Python 3.10–3.13
|
|
119
|
+
- **Publish** (`.github/workflows/publish.yml`) — uploads to PyPI on GitHub Release (Trusted Publisher / OIDC)
|
|
120
|
+
|
|
121
|
+
### First PyPI publish
|
|
122
|
+
|
|
123
|
+
1. On PyPI → **Publishing** → add a **pending trusted publisher**:
|
|
124
|
+
- Project: `pucit`
|
|
125
|
+
- Owner: `mudassir-cpp`
|
|
126
|
+
- Repo: `pucit`
|
|
127
|
+
- Workflow: `publish.yml`
|
|
128
|
+
- Environment: `pypi`
|
|
129
|
+
2. On GitHub → **Settings → Environments → New** → name it `pypi` (optional approval rule recommended).
|
|
130
|
+
3. Create a Release (e.g. tag `v0.1.0`) — the publish workflow runs and creates the PyPI project.
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
MIT — see `LICENSE.txt`.
|
pucit-0.1.0/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# pucit
|
|
2
|
+
|
|
3
|
+
PUCIT student toolkit CLI — install Oracle (Docker), set up PF/C++ essentials, campus proxy bypass, and compile/run lab code in one command.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pip install pucit
|
|
7
|
+
# or from source:
|
|
8
|
+
pip install -e ".[dev]"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pucit doctor
|
|
15
|
+
pucit install pf
|
|
16
|
+
pucit run main.cpp
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Commands
|
|
20
|
+
|
|
21
|
+
### C++ labs (ease)
|
|
22
|
+
|
|
23
|
+
| Command | What it does |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `pucit run main.cpp` | Compile with `g++` into `build/`, then run — no `./a.out` |
|
|
26
|
+
| `pucit compile main.cpp` | Compile only |
|
|
27
|
+
| `pucit debug main.cpp` | Compile with `-g` and open `gdb` |
|
|
28
|
+
| `pucit watch main.cpp` | Recompile + run on save |
|
|
29
|
+
| `pucit clean` | Remove `build/` and `a.out` |
|
|
30
|
+
| `pucit new hello` | Create `hello.cpp` from template |
|
|
31
|
+
| `pucit init` | Scaffold `main.cpp` + `Makefile` + `.gitignore` |
|
|
32
|
+
|
|
33
|
+
Extras:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pucit run main.cpp util.cpp
|
|
37
|
+
pucit run main.cpp -f "-O2 -std=c++20"
|
|
38
|
+
pucit run main.cpp -i input.txt
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Oracle (Docker)
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pucit install oracle
|
|
45
|
+
pucit start oracle
|
|
46
|
+
pucit stop oracle
|
|
47
|
+
pucit status oracle
|
|
48
|
+
pucit logs oracle
|
|
49
|
+
pucit oracle connect
|
|
50
|
+
pucit oracle rm
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Uses Oracle Database Free image `container-registry.oracle.com/database/free:latest` as container `pucit-oracle` on port `1521`. Password is saved under `~/.config/pucit/oracle.env`.
|
|
54
|
+
|
|
55
|
+
If pull fails with auth errors, accept the license on [Oracle Container Registry](https://container-registry.oracle.com/), then `docker login container-registry.oracle.com` and retry.
|
|
56
|
+
|
|
57
|
+
### Tooling / campus net
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pucit install pf # g++, make, gdb, cmake
|
|
61
|
+
pucit install docker
|
|
62
|
+
pucit install sqlclient # Instant Client / sqlplus guidance
|
|
63
|
+
pucit bypass set # wraps bypass-pucit
|
|
64
|
+
pucit bypass unset
|
|
65
|
+
pucit doctor
|
|
66
|
+
pucit list
|
|
67
|
+
pucit which g++
|
|
68
|
+
pucit open .
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Supported OS
|
|
72
|
+
|
|
73
|
+
Linux (dnf/apt/…) and Windows (winget/choco) for installers. `run` / `compile` work anywhere `g++` or `clang++` is available.
|
|
74
|
+
|
|
75
|
+
## Development / CI
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install -e ".[dev]"
|
|
79
|
+
pytest -q
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
GitHub Actions:
|
|
83
|
+
|
|
84
|
+
- **CI** (`.github/workflows/ci.yml`) — tests on Linux + Windows for Python 3.10–3.13
|
|
85
|
+
- **Publish** (`.github/workflows/publish.yml`) — uploads to PyPI on GitHub Release (Trusted Publisher / OIDC)
|
|
86
|
+
|
|
87
|
+
### First PyPI publish
|
|
88
|
+
|
|
89
|
+
1. On PyPI → **Publishing** → add a **pending trusted publisher**:
|
|
90
|
+
- Project: `pucit`
|
|
91
|
+
- Owner: `mudassir-cpp`
|
|
92
|
+
- Repo: `pucit`
|
|
93
|
+
- Workflow: `publish.yml`
|
|
94
|
+
- Environment: `pypi`
|
|
95
|
+
2. On GitHub → **Settings → Environments → New** → name it `pypi` (optional approval rule recommended).
|
|
96
|
+
3. Create a Release (e.g. tag `v0.1.0`) — the publish workflow runs and creates the PyPI project.
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
|
|
100
|
+
MIT — see `LICENSE.txt`.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pucit"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "PUCIT student toolkit CLI — Oracle, PF/C++, campus bypass, and ease-of-use commands"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
keywords = ["pucit", "PUCIT", "oracle", "cpp", "g++", "docker", "bypass"]
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "MIZI", email = "gem920se@gmail.com" },
|
|
15
|
+
]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
"Intended Audience :: Education",
|
|
20
|
+
"Operating System :: Microsoft :: Windows",
|
|
21
|
+
"Operating System :: POSIX :: Linux",
|
|
22
|
+
"Programming Language :: Python",
|
|
23
|
+
"Programming Language :: Python :: 3.8",
|
|
24
|
+
"Programming Language :: Python :: 3.9",
|
|
25
|
+
"Programming Language :: Python :: 3.10",
|
|
26
|
+
"Programming Language :: Python :: 3.11",
|
|
27
|
+
"Programming Language :: Python :: 3.12",
|
|
28
|
+
"Programming Language :: Python :: 3.13",
|
|
29
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
30
|
+
"Topic :: Education",
|
|
31
|
+
"Topic :: Software Development :: Build Tools",
|
|
32
|
+
]
|
|
33
|
+
dependencies = [
|
|
34
|
+
"typer>=0.12.0",
|
|
35
|
+
"rich>=13.0.0",
|
|
36
|
+
"bypass-pucit>=0.0.2",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[project.optional-dependencies]
|
|
40
|
+
dev = [
|
|
41
|
+
"pytest>=7.0.0",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[project.urls]
|
|
45
|
+
Documentation = "https://github.com/mudassir-cpp/pucit#readme"
|
|
46
|
+
Issues = "https://github.com/mudassir-cpp/pucit/issues"
|
|
47
|
+
Source = "https://github.com/mudassir-cpp/pucit"
|
|
48
|
+
|
|
49
|
+
[project.scripts]
|
|
50
|
+
pucit = "pucit.cli:app"
|
|
51
|
+
|
|
52
|
+
[tool.hatch.version]
|
|
53
|
+
path = "src/pucit/__about__.py"
|
|
54
|
+
|
|
55
|
+
[tool.pytest.ini_options]
|
|
56
|
+
testpaths = ["tests"]
|
|
57
|
+
pythonpath = ["src"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"""pucit — PUCIT student toolkit CLI."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import List, Optional
|
|
7
|
+
|
|
8
|
+
import typer
|
|
9
|
+
|
|
10
|
+
from pucit import __version__
|
|
11
|
+
from pucit import cpp_build
|
|
12
|
+
from pucit import docker_util as d
|
|
13
|
+
from pucit.commands.bypass import bypass_app
|
|
14
|
+
from pucit.commands.doctor import run_doctor, run_list
|
|
15
|
+
from pucit.commands.install import install_app
|
|
16
|
+
from pucit.commands.oracle import oracle_app
|
|
17
|
+
from pucit.commands.scaffold import init_project, new_file
|
|
18
|
+
from pucit.util import fail, first_existing, info, ok, run_cmd, run_streaming, which
|
|
19
|
+
|
|
20
|
+
app = typer.Typer(
|
|
21
|
+
name="pucit",
|
|
22
|
+
help="PUCIT student toolkit — Oracle, PF/C++, bypass, and lab ease commands.",
|
|
23
|
+
no_args_is_help=True,
|
|
24
|
+
add_completion=False,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
app.add_typer(install_app, name="install")
|
|
28
|
+
app.add_typer(bypass_app, name="bypass")
|
|
29
|
+
app.add_typer(oracle_app, name="oracle")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _oracle_target(target: str) -> None:
|
|
33
|
+
if target.lower() not in {"oracle", "db", "oracledb"}:
|
|
34
|
+
fail(f"Unknown target '{target}'. Try: oracle")
|
|
35
|
+
raise typer.Exit(1)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@app.command("start")
|
|
39
|
+
def start_cmd(target: str = typer.Argument(..., help="Service to start (oracle)")) -> None:
|
|
40
|
+
"""Start a managed service: pucit start oracle"""
|
|
41
|
+
_oracle_target(target)
|
|
42
|
+
from pucit.commands.oracle import oracle_start
|
|
43
|
+
|
|
44
|
+
oracle_start()
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@app.command("stop")
|
|
48
|
+
def stop_cmd(target: str = typer.Argument(..., help="Service to stop (oracle)")) -> None:
|
|
49
|
+
"""Stop a managed service: pucit stop oracle"""
|
|
50
|
+
_oracle_target(target)
|
|
51
|
+
from pucit.commands.oracle import oracle_stop
|
|
52
|
+
|
|
53
|
+
oracle_stop()
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@app.command("status")
|
|
57
|
+
def status_cmd(target: str = typer.Argument("oracle", help="Service (oracle)")) -> None:
|
|
58
|
+
"""Show service status: pucit status oracle"""
|
|
59
|
+
_oracle_target(target)
|
|
60
|
+
from pucit.commands.oracle import oracle_status
|
|
61
|
+
|
|
62
|
+
oracle_status()
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@app.command("logs")
|
|
66
|
+
def logs_cmd(
|
|
67
|
+
target: str = typer.Argument("oracle"),
|
|
68
|
+
follow: bool = typer.Option(False, "--follow", "-f"),
|
|
69
|
+
tail: int = typer.Option(100, "--tail"),
|
|
70
|
+
) -> None:
|
|
71
|
+
"""Show service logs: pucit logs oracle"""
|
|
72
|
+
_oracle_target(target)
|
|
73
|
+
from pucit.commands.oracle import oracle_logs
|
|
74
|
+
|
|
75
|
+
oracle_logs(follow=follow, tail=tail)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@app.command("run")
|
|
79
|
+
def run_cmd(
|
|
80
|
+
sources: Optional[List[str]] = typer.Argument(None, help="C++ sources (default: main.cpp)"),
|
|
81
|
+
flags: Optional[str] = typer.Option(None, "--flags", "-f", help='Extra flags e.g. "-O2"'),
|
|
82
|
+
std: Optional[str] = typer.Option(None, "--std", help="Language standard"),
|
|
83
|
+
out: Optional[str] = typer.Option(None, "--out", "-o", help="Output binary"),
|
|
84
|
+
input_file: Optional[str] = typer.Option(None, "--input", "-i", help="stdin from file"),
|
|
85
|
+
) -> None:
|
|
86
|
+
"""Compile and run: pucit run main.cpp"""
|
|
87
|
+
try:
|
|
88
|
+
code = cpp_build.execute_run(
|
|
89
|
+
list(sources or []),
|
|
90
|
+
flags=flags,
|
|
91
|
+
std=std,
|
|
92
|
+
out=out,
|
|
93
|
+
input_file=input_file,
|
|
94
|
+
)
|
|
95
|
+
except (FileNotFoundError, RuntimeError) as exc:
|
|
96
|
+
fail(str(exc))
|
|
97
|
+
raise typer.Exit(1) from exc
|
|
98
|
+
raise typer.Exit(code)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
@app.command("compile")
|
|
102
|
+
def compile_cmd(
|
|
103
|
+
sources: Optional[List[str]] = typer.Argument(None),
|
|
104
|
+
flags: Optional[str] = typer.Option(None, "--flags", "-f"),
|
|
105
|
+
std: Optional[str] = typer.Option(None, "--std"),
|
|
106
|
+
out: Optional[str] = typer.Option(None, "--out", "-o"),
|
|
107
|
+
) -> None:
|
|
108
|
+
"""Compile only: pucit compile main.cpp"""
|
|
109
|
+
try:
|
|
110
|
+
code = cpp_build.execute_run(
|
|
111
|
+
list(sources or []),
|
|
112
|
+
flags=flags,
|
|
113
|
+
std=std,
|
|
114
|
+
out=out,
|
|
115
|
+
compile_only=True,
|
|
116
|
+
)
|
|
117
|
+
except (FileNotFoundError, RuntimeError) as exc:
|
|
118
|
+
fail(str(exc))
|
|
119
|
+
raise typer.Exit(1) from exc
|
|
120
|
+
raise typer.Exit(code)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@app.command("debug")
|
|
124
|
+
def debug_cmd(
|
|
125
|
+
sources: Optional[List[str]] = typer.Argument(None),
|
|
126
|
+
flags: Optional[str] = typer.Option(None, "--flags", "-f"),
|
|
127
|
+
std: Optional[str] = typer.Option(None, "--std"),
|
|
128
|
+
out: Optional[str] = typer.Option(None, "--out", "-o"),
|
|
129
|
+
) -> None:
|
|
130
|
+
"""Compile with -g and open gdb."""
|
|
131
|
+
try:
|
|
132
|
+
resolved = cpp_build.resolve_sources(list(sources or []))
|
|
133
|
+
code, binary, _ = cpp_build.compile_sources(
|
|
134
|
+
resolved, out=out, flags=flags, std=std, debug=True
|
|
135
|
+
)
|
|
136
|
+
except (FileNotFoundError, RuntimeError) as exc:
|
|
137
|
+
fail(str(exc))
|
|
138
|
+
raise typer.Exit(1) from exc
|
|
139
|
+
if code != 0:
|
|
140
|
+
raise typer.Exit(code)
|
|
141
|
+
gdb = which("gdb")
|
|
142
|
+
if not gdb:
|
|
143
|
+
fail("gdb not found. Run: pucit install pf")
|
|
144
|
+
raise typer.Exit(1)
|
|
145
|
+
info(f"Starting gdb on {binary}")
|
|
146
|
+
raise typer.Exit(run_streaming([gdb, str(binary)]))
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
@app.command("watch")
|
|
150
|
+
def watch_cmd(
|
|
151
|
+
sources: Optional[List[str]] = typer.Argument(None),
|
|
152
|
+
flags: Optional[str] = typer.Option(None, "--flags", "-f"),
|
|
153
|
+
std: Optional[str] = typer.Option(None, "--std"),
|
|
154
|
+
out: Optional[str] = typer.Option(None, "--out", "-o"),
|
|
155
|
+
input_file: Optional[str] = typer.Option(None, "--input", "-i"),
|
|
156
|
+
) -> None:
|
|
157
|
+
"""Recompile + run on file change."""
|
|
158
|
+
try:
|
|
159
|
+
code = cpp_build.watch_run(
|
|
160
|
+
list(sources or []),
|
|
161
|
+
flags=flags,
|
|
162
|
+
std=std,
|
|
163
|
+
out=out,
|
|
164
|
+
input_file=input_file,
|
|
165
|
+
)
|
|
166
|
+
except (FileNotFoundError, RuntimeError) as exc:
|
|
167
|
+
fail(str(exc))
|
|
168
|
+
raise typer.Exit(1) from exc
|
|
169
|
+
raise typer.Exit(code)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
@app.command("clean")
|
|
173
|
+
def clean_cmd() -> None:
|
|
174
|
+
"""Remove build/ and a.out in the current directory."""
|
|
175
|
+
removed = cpp_build.clean_artifacts()
|
|
176
|
+
if not removed:
|
|
177
|
+
info("Nothing to clean")
|
|
178
|
+
else:
|
|
179
|
+
for path in removed:
|
|
180
|
+
ok(f"Removed {path}")
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
@app.command("new")
|
|
184
|
+
def new_cmd(
|
|
185
|
+
name: str = typer.Argument(..., help="File or stem, e.g. hello or hello.cpp"),
|
|
186
|
+
force: bool = typer.Option(False, "--force", "-f"),
|
|
187
|
+
) -> None:
|
|
188
|
+
"""Create a new C++ file from template."""
|
|
189
|
+
new_file(name, force=force)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
@app.command("init")
|
|
193
|
+
def init_cmd(force: bool = typer.Option(False, "--force", "-f")) -> None:
|
|
194
|
+
"""Scaffold a PF lab folder (main.cpp, Makefile, .gitignore)."""
|
|
195
|
+
init_project(force=force)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
@app.command("doctor")
|
|
199
|
+
def doctor_cmd() -> None:
|
|
200
|
+
"""Check compilers, Docker, Oracle, bypass, and friends."""
|
|
201
|
+
raise typer.Exit(run_doctor())
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
@app.command("list")
|
|
205
|
+
def list_cmd() -> None:
|
|
206
|
+
"""List managed components and their status."""
|
|
207
|
+
raise typer.Exit(run_list())
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
@app.command("version")
|
|
211
|
+
def version_cmd() -> None:
|
|
212
|
+
"""Show pucit version."""
|
|
213
|
+
typer.echo(__version__)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
@app.command("which")
|
|
217
|
+
def which_cmd(tool: str = typer.Argument(..., help="Tool name, e.g. g++ or docker")) -> None:
|
|
218
|
+
"""Show resolved path for a tool."""
|
|
219
|
+
# allow g++ style
|
|
220
|
+
path = which(tool) or first_existing((tool,))
|
|
221
|
+
if not path and tool in {"g++", "cxx", "compiler"}:
|
|
222
|
+
path = cpp_build.find_compiler()
|
|
223
|
+
if not path and tool == "docker":
|
|
224
|
+
path = d.docker_bin()
|
|
225
|
+
if path:
|
|
226
|
+
typer.echo(path)
|
|
227
|
+
else:
|
|
228
|
+
fail(f"{tool} not found")
|
|
229
|
+
raise typer.Exit(1)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
@app.command("open")
|
|
233
|
+
def open_cmd(path: str = typer.Argument(".", help="Path to open")) -> None:
|
|
234
|
+
"""Open a folder/file in VS Code, Cursor, or the file manager."""
|
|
235
|
+
target = Path(path).resolve()
|
|
236
|
+
editors = ("cursor", "code", "codium")
|
|
237
|
+
for editor in editors:
|
|
238
|
+
binary = which(editor)
|
|
239
|
+
if binary:
|
|
240
|
+
raise typer.Exit(run_cmd([binary, str(target)]).returncode)
|
|
241
|
+
# fallback file manager / start
|
|
242
|
+
import sys
|
|
243
|
+
|
|
244
|
+
if sys.platform.startswith("win"):
|
|
245
|
+
raise typer.Exit(run_cmd(["explorer", str(target)]).returncode)
|
|
246
|
+
opener = which("xdg-open")
|
|
247
|
+
if opener:
|
|
248
|
+
raise typer.Exit(run_cmd([opener, str(target)]).returncode)
|
|
249
|
+
fail("No editor or file manager found")
|
|
250
|
+
raise typer.Exit(1)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
def main() -> None:
|
|
254
|
+
app()
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
if __name__ == "__main__":
|
|
258
|
+
main()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Command modules for the pucit CLI."""
|