Skip to content

Commit

Permalink
Merge pull request #116 from gigalixir/fix-dependency-and-observer
Browse files Browse the repository at this point in the history
fix: pkg_resource dep and observer command
  • Loading branch information
gigatim authored Oct 2, 2024
2 parents 63a7153 + efc26fe commit abb3531
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
12 changes: 7 additions & 5 deletions gigalixir/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
import os
import platform
from functools import wraps
import pkg_resources
import importlib.metadata

CLI_VERSION = importlib.metadata.version("gigalixir")

def _show_usage_error(self, file=None):
if file is None:
Expand All @@ -61,7 +63,7 @@ def _show_usage_error(self, file=None):
if env == "prod":
rollbar.init(ROLLBAR_POST_CLIENT_ITEM, 'production',
enabled=True, allow_logging_basic_config=False,
code_version=pkg_resources.get_distribution("gigalixir").version)
code_version=CLI_VERSION)
elif env == "dev":
rollbar.init(ROLLBAR_POST_CLIENT_ITEM, 'development', enabled=False, allow_logging_basic_config=False)
elif env == "test":
Expand All @@ -85,7 +87,7 @@ def wrapper(*args, **kwds):
try:
f(*args, **kwds)
except:
version = pkg_resources.get_distribution("gigalixir").version
version = CLI_VERSION
rollbar.report_exc_info(sys.exc_info(), payload_data={"version": version})
logging.getLogger("gigalixir-cli").error(sys.exc_info()[1])
sys.exit(1)
Expand Down Expand Up @@ -228,7 +230,7 @@ def cli(ctx, env):
else:
raise Exception("Invalid GIGALIXIR_ENV")

ctx.obj['session'] = gigalixir_api_session.ApiSession(host, pkg_resources.get_distribution("gigalixir").version)
ctx.obj['session'] = gigalixir_api_session.ApiSession(host, CLI_VERSION)
ctx.obj['host'] = host
ctx.obj['env'] = env

Expand Down Expand Up @@ -1123,7 +1125,7 @@ def version(ctx):
"""
Show the CLI version.
"""
click.echo(pkg_resources.get_distribution("gigalixir").version)
click.echo(CLI_VERSION)


@cli.command(name='open')
Expand Down
2 changes: 1 addition & 1 deletion gigalixir/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def distillery_eval(session, app_name, ssh_opts, ssh_cmd, expression):
# capture_output == True as this isn't interactive
# and we want to return the result as a string rather than
# print it out to the screen
return ssh_helper(session, app_name, ssh_opts, ssh_cmd, True, "gigalixir_run", "distillery_eval", "--", expression)
return ssh_helper(session, app_name, ssh_opts, ssh_cmd, True, "gigalixir_run", "distillery-eval", "--", expression)

def distillery_command(session, app_name, ssh_opts, ssh_cmd, *args):
ssh(session, app_name, ssh_opts, ssh_cmd, "gigalixir_run", "shell", "--", "bin/%s" % customer_app_name(session, app_name), *args)
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
url='https://github.com/gigalixir/gigalixir-cli',
author='Tim Knight',
author_email='[email protected]',
version='1.13.0',
version='1.13.1',
packages=find_packages(),
include_package_data=True,
install_requires=[
'certifi>=2024.2.2',
'click>=8.1',
'cryptography>=38.0',
'importlib-metadata>=7.0.1',
'pygments>=2.13',
'pyOpenSSL>=22.1',
'qrcode>=7.3',
Expand Down

0 comments on commit abb3531

Please sign in to comment.