Skip to content

Commit 0839b02

Browse files
author
Chad Smith
authored
Merge pull request #15 from cs01/cs01/fix-host-arg
add noxfile and fix -host arg
2 parents f59362c + 57133d8 commit 0839b02

File tree

4 files changed

+65
-5
lines changed

4 files changed

+65
-5
lines changed

noxfile.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import subprocess
2+
import sys
3+
from pathlib import Path
4+
5+
import nox # type: ignore
6+
7+
nox.options.reuse_existing_virtualenvs = True
8+
9+
10+
def has_changes():
11+
status = (
12+
subprocess.run(
13+
"git status --porcelain", shell=True, check=True, stdout=subprocess.PIPE
14+
)
15+
.stdout.decode()
16+
.strip()
17+
)
18+
return len(status) > 0
19+
20+
21+
def on_master_no_changes(session):
22+
if has_changes():
23+
session.error("All changes must be committed or removed before publishing")
24+
# branch = get_branch()
25+
# if branch != "master":
26+
# session.error(f"Must be on 'master' branch. Currently on {branch!r} branch")
27+
28+
29+
def get_branch():
30+
return (
31+
subprocess.run(
32+
"git rev-parse --abbrev-ref HEAD",
33+
shell=True,
34+
check=True,
35+
stdout=subprocess.PIPE,
36+
)
37+
.stdout.decode()
38+
.strip()
39+
)
40+
41+
42+
@nox.session()
43+
def build(session):
44+
session.install("--upgrade", "pip")
45+
session.install("build")
46+
session.run("rm", "-rf", "dist", "build", external=True)
47+
session.run("python", "-m", "build")
48+
49+
50+
@nox.session()
51+
def publish(session):
52+
on_master_no_changes(session)
53+
session.install("--upgrade", "pip")
54+
session.install("twine")
55+
build(session)
56+
print("REMINDER: Has the changelog been updated?")
57+
session.run("python", "-m", "twine", "upload", "dist/*")

pyxtermjs/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
if __name__ == "__main__":
5-
exit(main())
5+
exit(main())

pyxtermjs/app.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import shlex
1313

1414

15-
__version__ = "0.4.0.1"
15+
__version__ = "0.4.0.2rc0"
1616

1717
app = Flask(__name__, template_folder=".", static_folder=".", static_url_path="")
1818
app.config["SECRET_KEY"] = "secret!"
@@ -99,7 +99,11 @@ def main():
9999
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
100100
)
101101
parser.add_argument("-p", "--port", default=5000, help="port to run server on")
102-
parser.add_argument("-host", "--host", default='127.0.0.1', help="host to run server on (use 0.0.0.0 to allow access from other hosts)")
102+
parser.add_argument(
103+
"--host",
104+
default="127.0.0.1",
105+
help="host to run server on (use 0.0.0.0 to allow access from other hosts)",
106+
)
103107
parser.add_argument("--debug", action="store_true", help="debug the server")
104108
parser.add_argument("--version", action="store_true", help="print version and exit")
105109
parser.add_argument(

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python3
2-
# -*- coding: utf-8 -*-
32

43
import sys
54

@@ -40,7 +39,7 @@ def get_version() -> str:
4039
description="interactive terminal in the browser",
4140
long_description=README,
4241
long_description_content_type="text/markdown",
43-
url="https://github.com/cs01/pyxterm.js",
42+
url="https://github.com/cs01/pyxtermjs",
4443
license="License :: OSI Approved :: MIT License",
4544
packages=find_packages(exclude=EXCLUDE_FROM_PACKAGES),
4645
include_package_data=True,

0 commit comments

Comments
 (0)