Skip to content
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

Finds last rev that built, and caches github #97

Merged
merged 6 commits into from Feb 7, 2018

Conversation

CarlFK
Copy link
Contributor

@CarlFK CarlFK commented Feb 6, 2018

if the target isn't found,

find_last_rev(args, possible_revs) - prints the last ver and exits.

python3 download-prebuilt-firmware.py --platform opsis
Did not find target hdmi2usb for platform opsis at rev v0.0.4-132-g8daff41 (found base, net)
try try try.,,,
found at rev v0.0.4-122-gbc7feb5
(returns to prompt)

so now you can decide to get it:

python3 download-prebuilt-firmware.py --platform opsis --rev v0.0.4-122-gbc7feb5
...
Downloading to: image-gateware+bios+firmware.v0.0.4-122-gbc7feb5.opsis.hdmi2usb.lm32.bin

ls_github(url) now saves its data to github.pickle -
2. special case for the top level dir. Age it - reload after 20 min.

import sys
import time
import urllib.request

class Target_not_found(Exception):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class TargetNotFound(Exception):

archive_url = get_url(args)

for rev in possible_revs:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To many new lines....

import doctest
import json
import os
import pickle
from pprint import pprint
import sys
import time
import urllib.request
Copy link
Member

@mithro mithro Feb 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you order the imports

[H306] Alphabetically order your imports by the full module path. Organize your imports according to the Import order template and Real-world Import Order Examples below. For the purposes of import order, OpenStack projects other than the one to which the file belongs are considered “third party”. Only imports from the same Git repo are considered “project imports”

import a_standard
import b_standard

import a_third_party
import b_third_party

from a_soc import f
from a_soc import g
from b_soc import d

https://pypi.python.org/pypi/isort/

@mithro
Copy link
Member

mithro commented Feb 6, 2018

@CarlFK - I'll make you into a proper Python developer yet :-P

@timvideos timvideos deleted a comment Feb 7, 2018
@timvideos timvideos deleted a comment Feb 7, 2018
@timvideos timvideos deleted a comment Feb 7, 2018
@timvideos timvideos deleted a comment Feb 7, 2018
@timvideos timvideos deleted a comment Feb 7, 2018
@timvideos timvideos deleted a comment Feb 7, 2018
@mithro
Copy link
Member

mithro commented Feb 7, 2018

I just disable the warning about pickle.

@timvideos timvideos deleted a comment Feb 7, 2018
@timvideos timvideos deleted a comment Feb 7, 2018
Copy link
Member

@mithro mithro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix the title? BTW For WIP pull requests, please put WIP in the title.

Otherwise, with these minor fixes I'm happy to merge.

@@ -193,11 +227,33 @@ def get_targets(args, rev, targets_url):
print("Did not find target {} for platform {} at rev {} (found {})".
format(args.target, args.platform, rev,
", ".join(possible_targets)))
sys.exit(1)
# pprint(possible_targets)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment.

@CarlFK CarlFK changed the title finds last rev that built, and caches github (indefinately, so bad.) finds last rev that built, and caches github Feb 7, 2018
@CarlFK
Copy link
Contributor Author

CarlFK commented Feb 7, 2018 via email

@timvideos timvideos deleted a comment Feb 7, 2018
Copy link
Member

@mithro mithro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the title of the pull request to start with a capital.


return possible_targets


def find_last_rev(args, possible_revs):

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove all the extra newlines inside the def find_last_rev function.

time.sleep(1)
continue
else:
break
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format the cache[url] dictionary more normally. I think this is pep8 compliant?

       cache[url] = {
           'timestamp': datetime.now(),
           'data': data,
       }

@CarlFK CarlFK changed the title finds last rev that built, and caches github Finds last rev that built, and caches github Feb 7, 2018
@mithro
Copy link
Member

mithro commented Feb 7, 2018

LGTM! -- Merging.

@mithro mithro merged commit 7bd2e9f into timvideos:master Feb 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants