Skip to content

Commit abb3531

Browse files
authored
Merge pull request #116 from gigalixir/fix-dependency-and-observer
fix: pkg_resource dep and observer command
2 parents 63a7153 + efc26fe commit abb3531

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

gigalixir/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
import os
4040
import platform
4141
from functools import wraps
42-
import pkg_resources
42+
import importlib.metadata
43+
44+
CLI_VERSION = importlib.metadata.version("gigalixir")
4345

4446
def _show_usage_error(self, file=None):
4547
if file is None:
@@ -61,7 +63,7 @@ def _show_usage_error(self, file=None):
6163
if env == "prod":
6264
rollbar.init(ROLLBAR_POST_CLIENT_ITEM, 'production',
6365
enabled=True, allow_logging_basic_config=False,
64-
code_version=pkg_resources.get_distribution("gigalixir").version)
66+
code_version=CLI_VERSION)
6567
elif env == "dev":
6668
rollbar.init(ROLLBAR_POST_CLIENT_ITEM, 'development', enabled=False, allow_logging_basic_config=False)
6769
elif env == "test":
@@ -85,7 +87,7 @@ def wrapper(*args, **kwds):
8587
try:
8688
f(*args, **kwds)
8789
except:
88-
version = pkg_resources.get_distribution("gigalixir").version
90+
version = CLI_VERSION
8991
rollbar.report_exc_info(sys.exc_info(), payload_data={"version": version})
9092
logging.getLogger("gigalixir-cli").error(sys.exc_info()[1])
9193
sys.exit(1)
@@ -228,7 +230,7 @@ def cli(ctx, env):
228230
else:
229231
raise Exception("Invalid GIGALIXIR_ENV")
230232

231-
ctx.obj['session'] = gigalixir_api_session.ApiSession(host, pkg_resources.get_distribution("gigalixir").version)
233+
ctx.obj['session'] = gigalixir_api_session.ApiSession(host, CLI_VERSION)
232234
ctx.obj['host'] = host
233235
ctx.obj['env'] = env
234236

@@ -1123,7 +1125,7 @@ def version(ctx):
11231125
"""
11241126
Show the CLI version.
11251127
"""
1126-
click.echo(pkg_resources.get_distribution("gigalixir").version)
1128+
click.echo(CLI_VERSION)
11271129

11281130

11291131
@cli.command(name='open')

gigalixir/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def distillery_eval(session, app_name, ssh_opts, ssh_cmd, expression):
120120
# capture_output == True as this isn't interactive
121121
# and we want to return the result as a string rather than
122122
# print it out to the screen
123-
return ssh_helper(session, app_name, ssh_opts, ssh_cmd, True, "gigalixir_run", "distillery_eval", "--", expression)
123+
return ssh_helper(session, app_name, ssh_opts, ssh_cmd, True, "gigalixir_run", "distillery-eval", "--", expression)
124124

125125
def distillery_command(session, app_name, ssh_opts, ssh_cmd, *args):
126126
ssh(session, app_name, ssh_opts, ssh_cmd, "gigalixir_run", "shell", "--", "bin/%s" % customer_app_name(session, app_name), *args)

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
url='https://github.com/gigalixir/gigalixir-cli',
66
author='Tim Knight',
77
author_email='tim@gigalixir.com',
8-
version='1.13.0',
8+
version='1.13.1',
99
packages=find_packages(),
1010
include_package_data=True,
1111
install_requires=[
1212
'certifi>=2024.2.2',
1313
'click>=8.1',
1414
'cryptography>=38.0',
15+
'importlib-metadata>=7.0.1',
1516
'pygments>=2.13',
1617
'pyOpenSSL>=22.1',
1718
'qrcode>=7.3',

0 commit comments

Comments
 (0)