-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a8c9f18
commit 3819d48
Showing
188 changed files
with
8,492 additions
and
2,128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
from pathlib import Path | ||
import re | ||
from packaging.version import Version | ||
|
||
|
||
import subprocess | ||
|
||
docs = Path('docs') | ||
example = Path('example') | ||
dist = Path('dist') | ||
egg = Path('nodriver.egg-info') | ||
|
||
|
||
def find_file(pattern: str , root: str ='.', recursive: bool =True): | ||
root = Path(root).resolve() | ||
glob = root.glob if not recursive else root.rglob | ||
for o in glob(pattern): | ||
if o.is_file(): | ||
return o | ||
|
||
|
||
def find_replace_in_file(file, search, repl): | ||
file = Path(file).resolve() | ||
binary = False | ||
try: | ||
content = file.read_text() | ||
except UnicodeDecodeError: | ||
content = file.read_bytes() | ||
binary = True | ||
if binary: | ||
try: | ||
search = search.encode() | ||
repl = repl.encode() | ||
except: | ||
pass | ||
file.write_bytes(re.sub(search, repl, content)) | ||
else: | ||
file.write_text(re.sub(search, repl, content)) | ||
|
||
def remove(path): | ||
path = Path(path).resolve() | ||
if path.is_file(): | ||
path.unlink() | ||
return True | ||
for item in path.rglob('*'): | ||
if item.is_file(): | ||
item.unlink() | ||
continue | ||
remove(item) | ||
path.rmdir() | ||
return True | ||
|
||
|
||
def change_version(): | ||
|
||
current = Version(get_version(project_file)) | ||
new_version = None | ||
while not new_version: | ||
try: | ||
new_version = Version(input(f'change version (current: {current})? : ')) | ||
except: | ||
continue | ||
if new_version != current: | ||
find_replace_in_file(project_file, 'version = [\"\']([^\s]+)[\"\']', f'version = "{new_version}"') | ||
|
||
|
||
def get_version(project_file: Path): | ||
content = project_file.read_text() | ||
return re.search('version = [\"\']([^\s]+)[\"\']', content)[1] | ||
|
||
|
||
project_file = find_file('pyproject.toml') | ||
|
||
|
||
subprocess.run('make.bat html', shell=True, cwd='./docs') | ||
subprocess.run('make.bat markdown', shell=True, cwd='./docs') | ||
subprocess.run('copy docs\\_build\\markdown\\README.md .', shell=True) | ||
change_version() | ||
subprocess.run('git add docs nodriver pyproject.toml example README.md') | ||
subprocess.run('git status') | ||
commit = input('commit?:') | ||
if commit: | ||
subprocess.run(f'git commit -m "{commit}"') | ||
|
||
subprocess.run('python -m build') | ||
subprocess.run('twine upload dist\\*') | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
-185 Bytes
(100%)
docs/_build/doctrees/nodriver/cdp/background_service.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
-25 Bytes
(100%)
docs/_build/doctrees/nodriver/cdp/device_orientation.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
-35 Bytes
(100%)
docs/_build/doctrees/nodriver/cdp/event_breakpoints.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
-65 Bytes
(100%)
docs/_build/doctrees/nodriver/cdp/headless_experimental.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
-160 Bytes
(100%)
docs/_build/doctrees/nodriver/cdp/performance_timeline.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
-195 Bytes
(100%)
docs/_build/doctrees/nodriver/classes/others_and_helpers.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.