Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Basthon
Basthon Kernel
Commits
cb959f9b
Commit
cb959f9b
authored
Jan 26, 2021
by
Romain Casati
Browse files
Use of pathlib in basthon-kernel __main__ instead of os.path.
parent
0e2bd2da
Changes
1
Hide whitespace changes
Inline
Side-by-side
setup/basthon-kernel/__main__.py
View file @
cb959f9b
...
...
@@ -2,7 +2,7 @@
current directory.
"""
import
os
from
pathlib
import
Path
import
shutil
import
argparse
...
...
@@ -12,7 +12,8 @@ from . import implementation
def
main
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--install'
,
help
=
'Install Basthon kernel in current directory'
,
parser
.
add_argument
(
'--install'
,
help
=
'Install Basthon kernel in current directory'
,
action
=
"store_true"
)
args
=
parser
.
parse_args
()
...
...
@@ -21,15 +22,13 @@ def main():
print
(
'Installing Basthon kernel {} in current directory'
.
format
(
implementation
))
data_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
)
,
'data'
)
data_path
=
Path
(
__file__
)
.
parent
/
'data'
for
root
,
dirs
,
files
in
os
.
walk
(
data_path
):
for
f
in
files
:
f
=
os
.
path
.
join
(
root
,
f
)
shutil
.
copyfile
(
f
,
os
.
path
.
relpath
(
f
,
data_path
))
for
d
in
dirs
:
d
=
os
.
path
.
join
(
root
,
d
)
os
.
makedirs
(
os
.
path
.
relpath
(
d
,
data_path
),
exist_ok
=
True
)
for
path
in
data_path
.
rglob
(
"*"
):
if
path
.
is_file
():
shutil
.
copyfile
(
path
,
path
.
relative_to
(
data_path
))
elif
path
.
is_dir
():
path
.
relative_to
(
data_path
).
mkdir
(
exist_ok
=
True
)
if
__name__
==
"__main__"
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment