Skip to content

Commit

Permalink
update to new ubuntu and shorten jira query to 30 chars
Browse files Browse the repository at this point in the history
  • Loading branch information
gsobczyk committed Nov 12, 2024
1 parent cf09ca2 commit 76fcac4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
pyxdg
setuptools
dbus-python
PyGObject
urllib3
jira
8 changes: 5 additions & 3 deletions src/hamster/external/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
except ImportError:
JIRA = None
urllib3 = None
logger.warning("urllib3 or jira module not found")

SOURCE_NONE = ""
SOURCE_JIRA = 'jira'
Expand Down Expand Up @@ -67,6 +68,7 @@ def __init__(self, conf):

def __connect(self, conf):
if self.source == SOURCE_JIRA:
print("JIRA: %s" % JIRA)
if JIRA:
self.__http = urllib3.PoolManager()
self.__connect_to_jira(conf)
Expand Down Expand Up @@ -98,7 +100,8 @@ def get_activities(self, query=None):
if not self.source:
return []
elif self.source == SOURCE_JIRA:
activities = self.__jira_get_activities(query, self.jira_query)
# shorten query to 30 characters
activities = self.__jira_get_activities(query[:30], self.jira_query)
direct_issue = None
issue_match = re.match(JIRA_ISSUE_NAME_REGEX, query)
if query and issue_match:
Expand All @@ -114,8 +117,7 @@ def get_activities(self, query=None):
words = query.split(' ')
# filter empty elements
fragments = filter(len, [self.__generate_fragment_jira_query(word) for word in words])
jira_query = " AND ".join(
fragments) + " AND resolution = Unresolved order by priority desc, updated desc"
jira_query = " AND ".join(fragments) + " AND resolution = Unresolved order by priority desc, updated desc"
logging.info(jira_query)
default_jira_activities = self.__jira_get_activities('', jira_query)
activities.extend(default_jira_activities)
Expand Down
4 changes: 2 additions & 2 deletions src/hamster/lib/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,14 +472,14 @@ def format(self, default_day=None, explicit_none=True):

@classmethod
def parse(cls, text,
position="exact", separator="\s+", default_day=None, ref="now"):
position="exact", separator="\\s+", default_day=None, ref="now"):
"""Parse a start-end range from text.
position (str): "exact" to match exactly the full text
"head" to search only at the beginning of text, and
"tail" to search only at the end.
separator (str): regexp pattern (e.g. '\s+') meant to separate the datetime
separator (str): regexp pattern (e.g. '\\s+') meant to separate the datetime
from the rest. Discarded for "exact" position.
default_day (date): If start is given without any date (e.g. just hh:mm),
Expand Down
4 changes: 2 additions & 2 deletions waflib/Context.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Classes and functions enabling the command system
"""

import os, re, imp, sys
import os, re, types, sys
from waflib import Utils, Errors, Logs
import waflib.Node

Expand Down Expand Up @@ -660,7 +660,7 @@ def load_module(path, encoding=None):
except KeyError:
pass

module = imp.new_module(WSCRIPT_FILE)
module = types.ModuleType(WSCRIPT_FILE)
try:
code = Utils.readf(path, m='r', encoding=encoding)
except EnvironmentError:
Expand Down

0 comments on commit 76fcac4

Please sign in to comment.