Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
setuptools
tzlocal
utcdatetime
zipfile2
Expand Down
4 changes: 2 additions & 2 deletions sciunit2/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from getopt import getopt, GetoptError
from io import StringIO
import textwrap
import pkg_resources
from importlib.metadata import version as pkg_version
import os
import platform

Expand Down Expand Up @@ -92,7 +92,7 @@ def _main(args):
subcommand_usage(sys.stdout, [cls() for cls in __cmds__])
return
elif op == '--version':
print(pkg_resources.require("sciunit2")[0])
print(pkg_version("sciunit2"))
return
elif op == '--root': # pragma: no cover
import sciunit2.workspace
Expand Down
4 changes: 2 additions & 2 deletions sciunit2/command/exec_/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sciunit2.workspace

from getopt import getopt
from pkg_resources import resource_filename
from importlib.resources import files


class ExecCommand(CommitMixin, AbstractCommand):
Expand All @@ -28,7 +28,7 @@ def run(self, args):
with emgr.exclusive():
rev = emgr.add(args)
if optlist:
standin_fn = resource_filename(__name__, 'sciunit')
standin_fn = str(files(__name__).joinpath('sciunit'))
sciunit2.core.shell(env=path_injection_for(standin_fn))
else:
sciunit2.core.capture(args)
Expand Down
7 changes: 4 additions & 3 deletions sciunit2/command/post_install/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
import pwd
import tempfile
import pkg_resources
from importlib.resources import files
from shutil import copyfileobj
from contextlib import closing
from humanfriendly import format_path
Expand Down Expand Up @@ -43,7 +43,8 @@ def patch_shell_script(from_, to, rcfile):
to_ = os.path.expanduser(to)
with tempfile.NamedTemporaryFile(dir=os.path.dirname(to_),
prefix='pip-tmp') as tmp:
script = pkg_resources.resource_stream(__name__, from_)
script_path = files(__name__).joinpath(from_)
script = script_path.open("rb")
try:
with closing(script) as g, closing(open(to_, 'a+')) as f:
f.seek(0)
Expand All @@ -68,4 +69,4 @@ def patch_shell_script(from_, to, rcfile):
print('Unable to patch %s. Please copy\n\n %s\n\n'
'to a subdirectory of your home directory '
'and "source" it in %s.' %
(to, format_path(script.name), rcfile))
(to, format_path(str(script_path)), rcfile))
Loading