Restructure to Python package
This commit is contained in:
parent
e363bfd13c
commit
26cb8a5ed7
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
__pycache__
|
__pycache__
|
||||||
*.pyc
|
*.pyc
|
||||||
|
*.egg-info
|
||||||
|
44
README.md
Normal file
44
README.md
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
psh
|
||||||
|
===
|
||||||
|
|
||||||
|
Augmented Unix Userland shell inspired by Windows PowerShell, written in Python.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
* Python 3+
|
||||||
|
* pip
|
||||||
|
|
||||||
|
Installing
|
||||||
|
----------
|
||||||
|
|
||||||
|
Preferably, you would use a separate virtual env
|
||||||
|
|
||||||
|
```
|
||||||
|
pip install -r requirements.txt
|
||||||
|
pip install -e . # installs the 'psh' package in editable mode
|
||||||
|
```
|
||||||
|
|
||||||
|
Running
|
||||||
|
-------
|
||||||
|
|
||||||
|
From Python shell:
|
||||||
|
|
||||||
|
```
|
||||||
|
from psh.run import main
|
||||||
|
main()
|
||||||
|
```
|
||||||
|
|
||||||
|
From Unix shell:
|
||||||
|
```
|
||||||
|
python -m psh.run
|
||||||
|
```
|
||||||
|
|
||||||
|
Testing
|
||||||
|
-------
|
||||||
|
|
||||||
|
From Unix shell:
|
||||||
|
|
||||||
|
```
|
||||||
|
py.test
|
||||||
|
```
|
0
psh/__init__.py
Normal file
0
psh/__init__.py
Normal file
@ -4,8 +4,8 @@ import os
|
|||||||
import readline
|
import readline
|
||||||
import shlex
|
import shlex
|
||||||
|
|
||||||
from commands import registered_cmds
|
from psh.commands import registered_cmds
|
||||||
import example_cmd
|
import psh.example_cmd
|
||||||
|
|
||||||
DEFAULT_HISTORY_FILE = "~/.psh_history"
|
DEFAULT_HISTORY_FILE = "~/.psh_history"
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
from commands import BaseCommand, register_cmd
|
from psh.commands import BaseCommand, register_cmd
|
||||||
|
|
||||||
|
|
||||||
@register_cmd
|
@register_cmd
|
@ -1,4 +1,4 @@
|
|||||||
from commands import BaseCommand
|
from psh.commands import BaseCommand
|
||||||
|
|
||||||
|
|
||||||
class Printer(BaseCommand):
|
class Printer(BaseCommand):
|
@ -1,5 +1,5 @@
|
|||||||
from formatters import Printer
|
from psh.formatters import Printer
|
||||||
from commands import BaseCommand
|
from psh.commands import BaseCommand
|
||||||
|
|
||||||
|
|
||||||
class RawCommand(BaseCommand):
|
class RawCommand(BaseCommand):
|
@ -1,8 +1,8 @@
|
|||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
from formatters import *
|
from psh.formatters import *
|
||||||
from raw_commands import RawCommand
|
from psh.raw_commands import RawCommand
|
||||||
|
|
||||||
# Load all of the commands in the path into the global namespace as raw
|
# Load all of the commands in the path into the global namespace as raw
|
||||||
# commands.
|
# commands.
|
||||||
@ -15,7 +15,7 @@ for path in os.environ['PATH'].split(':'):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
from console import HistoryConsole
|
from psh.console import HistoryConsole
|
||||||
console = HistoryConsole(globals())
|
console = HistoryConsole(globals())
|
||||||
console.interact("Augmented Unix Userland")
|
console.interact("Augmented Unix Userland")
|
||||||
|
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
pytest
|
20
setup.py
Normal file
20
setup.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import os
|
||||||
|
from setuptools import setup
|
||||||
|
|
||||||
|
# Utility function to read the README file.
|
||||||
|
# Used for the long_description. It's nice, because now 1) we have a top level
|
||||||
|
# README file and 2) it's easier to type in the README file than to put a raw
|
||||||
|
# string in below ...
|
||||||
|
def read(fname):
|
||||||
|
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name = "psh",
|
||||||
|
version = "0.0.1",
|
||||||
|
author = "WPI Augmented Unix Userland MQP",
|
||||||
|
author_email = "jsh@wpi.edu",
|
||||||
|
description = ("Simple Unix shell inspired by PowerShell"),
|
||||||
|
license = "MIT",
|
||||||
|
packages=['psh'],
|
||||||
|
long_description=read('README.md'),
|
||||||
|
)
|
Reference in New Issue
Block a user