Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eepm
Commits
ce5faf84
Commit
ce5faf84
authored
Aug 05, 2023
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
epm restore: add pyproject.toml support
parent
c906a079
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
1 deletion
+59
-1
epm-restore
bin/epm-restore
+59
-1
No files found.
bin/epm-restore
View file @
ce5faf84
...
...
@@ -168,6 +168,61 @@ __epm_restore_pip()
docmd epm
install
$ilist
}
__epm_restore_print_toml
()
{
local
lt
lt
=
$(
mktemp
)
||
fatal
remove_on_exit
$lt
cat
<<
EOF
>
$lt
#!//usr/bin/env python3
# https://realpython.com/python-toml/
import sys
import toml
if len(sys.argv) < 2:
raise Exception('Run me with a file')
pyproject = sys.argv[1]
c = toml.load(pyproject)
n = c["tool"]["poetry"]["dependencies"]
for key, value in n.items():
if isinstance(value, dict):
print('\n' + key + ' ' , value["version"])
else:
print('\n' + key + ' ' + value)
EOF
a
=
python3
$lt
"
$1
"
}
__epm_restore_print_pyproject
()
{
local
req_file
=
"
$1
"
__epm_restore_print_toml
"
$req_file
"
| __epm_restore_convert_to_rpm_notation |
sed
-e
's|\*||'
-e
's|\^|>= |'
}
__epm_restore_pyproject
()
{
local
req_file
=
"
$1
"
local
reqmacro
local
ilist
if
[
-n
"
$dryrun
"
]
;
then
reqmacro
=
"%py3_use"
echo
__epm_restore_print_comment
"
$req_file
"
__epm_restore_print_pyproject
"
$req_file
"
|
sed
-e
"s|^|
$reqmacro
|"
return
else
info
"Install requirements from
$req_file
..."
ilist
=
"
$(
__epm_restore_print_pyproject
"
$req_file
"
|
cut
-d
' '
-f
1 |
sed
-e
"s|^|python3-module-|"
)
"
fi
ilist
=
"
$(
estrlist list
$ilist
)
"
docmd epm
install
$ilist
}
__eresection
()
{
rhas
"
$1
"
"[[:space:]]*
$2
[[:space:]]*=[[:space:]]*[
\[
(]"
...
...
@@ -552,6 +607,9 @@ __epm_restore_by()
setup.py|python_dependencies.py
)
[
-s
"
$req_file
"
]
&&
__epm_restore_setup_py
"
$req_file
"
;;
pyproject.toml
)
[
-s
"
$req_file
"
]
&&
__epm_restore_pyproject
"
$req_file
"
;;
package.json
)
[
-s
"
$req_file
"
]
&&
__epm_restore_npm
"
$req_file
"
;;
...
...
@@ -596,7 +654,7 @@ epm_restore()
# if run with empty args
for
i
in
requirements.txt requirements/default.txt requirements_dev.txt requirements-dev.txt requirements/dev.txt dev-requirements.txt
\
requirements-test.txt requirements_test.txt requirements/test.txt test-requirements.txt requirements/coverage.txt
\
Gemfile requires.txt package.json setup.py python_dependencies.py Makefile.PL meson.build
\
Gemfile requires.txt package.json setup.py python_dependencies.py Makefile.PL meson.build
pyproject.toml
\
*
.sln
*
.csproj
;
do
__epm_restore_by
$i
done
...
...
Write
Preview
Markdown
is supported
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