-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Development file support #4
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,8 @@ | |
|
||
PRETTYNAME = '^%s-.*-([0-9]+\.[0-9]+\.[0-9]+)' % DISTRO_NAME | ||
|
||
PRETTYNAME_NIGHTLY = '^LibreELEC-.*-([0-9]+\.[0-9]+\-.*-[0-9]{8}-[0-9a-z]{7})' % DISTRO_NAME | ||
# For DEVEL(14 numbers), NIGHTLY(8 numbers), DAILY (7 numbers), WEEKLY (6 numbers), MONTHLY (6 numbers) builds | ||
PRETTYNAME_DEVELOPMENT_BUILDS = '^%s-.*-([0-9]+\.[0-9]+\-.*\-[0-9]{6,14}-[0-9a-z]{7})' % DISTRO_NAME | ||
|
||
class ChunkedHash(): | ||
# Calculate hash for chunked data | ||
|
@@ -92,7 +93,10 @@ def __init__(self, args): | |
if args.prettyname: | ||
self._prettyname = args.prettyname | ||
else: | ||
self._prettyname = PRETTYNAME | ||
if args.dev_prettyname: | ||
self._prettyname = PRETTYNAME_DEVELOPMENT_BUILDS | ||
else: | ||
self._prettyname = PRETTYNAME | ||
|
||
if not os.path.exists(self._indir): | ||
raise Exception('ERROR: %s is not a valid path' % self._indir) | ||
|
@@ -102,7 +106,7 @@ def __init__(self, args): | |
|
||
self._regex_xyz_custom_sort = re.compile(r'([0-9]+)\.([0-9]+)\.([0-9]+)') | ||
self._regex_xydate_custom_sort = re.compile(r'([0-9]+)\.([0-9]+)-.*-([0-9]{14})-') | ||
self._regex_xydate_custom_short_sort = re.compile(r'([0-9]+)\.([0-9]+)-.*-([0-9]{8})-') | ||
self._regex_xydate_custom_short_sort = re.compile(r'([0-9]+)\.([0-9]+)-.*-([0-9]{6,8})-') | ||
self._regex_builds = re.compile(r'%s-([^-]*)-.*' % DISTRO_NAME) | ||
|
||
self.display_name = {'A64.arm': 'Allwinner A64', | ||
|
@@ -191,13 +195,19 @@ def custom_sort_release(self, a, b): | |
if not a_maj_min_patch: | ||
a_maj_min_patch = self._regex_xydate_custom_short_sort.search(a) | ||
|
||
if not a_maj_min_patch: | ||
raise Exception('ERROR: Filename not like expected') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An f-string, or similar, to make this exception more useful:
|
||
|
||
b_maj_min_patch = self._regex_xyz_custom_sort.search(b) | ||
if not b_maj_min_patch: | ||
b_maj_min_patch = self._regex_xydate_custom_sort.search(b) | ||
|
||
if not b_maj_min_patch: | ||
b_maj_min_patch = self._regex_xydate_custom_short_sort.search(b) | ||
|
||
if not b_maj_min_patch: | ||
raise Exception('ERROR: Filename not like expected') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as for |
||
|
||
a_int = int('%04d%04d%014d' % (int(a_maj_min_patch.groups(0)[0]), int(a_maj_min_patch.groups(0)[1]), int(a_maj_min_patch.groups(0)[2]))) | ||
b_int = int('%04d%04d%014d' % (int(b_maj_min_patch.groups(0)[0]), int(b_maj_min_patch.groups(0)[1]), int(b_maj_min_patch.groups(0)[2]))) | ||
|
||
|
@@ -394,6 +404,9 @@ def WriteFile(self): | |
parser.add_argument('-p', '--prettyname', metavar='REGEX', required=False, \ | ||
help='Optional prettyname regex, default is %s' % PRETTYNAME) | ||
|
||
parser.add_argument('-d', '--dev_prettyname', action="store_true", required=False, \ | ||
help=' Enable prettyname regex for development builds (devel, nightly, daily, weekly, monthly)') | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leading space in the help string. |
||
parser.add_argument('-v', '--verbose', action="store_true", help='Enable verbose output (ignored files etc.)') | ||
|
||
args = parser.parse_args() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be an
elif
at same indent.