Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Native deps sync + native_package_install fixes #22

Merged
merged 14 commits into from
Nov 17, 2016
Merged

Conversation

ento
Copy link
Contributor

@ento ento commented Nov 16, 2016

  • Adds native_deps_sync.py, counterpart of elm_deps_sync.py for elm-native-package.json
  • Fixes native_package_install:
    • don't install a package if the tarball is already downloaded
    • don't generate trailing whitespaces when updating elm-package.json
    • python 3 compatibility

@eeue56 eeue56 self-assigned this Nov 16, 2016
import argparse

import elm_package
Copy link
Contributor

Choose a reason for hiding this comment

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

I was edging against this so that the file could be run by itself without needing the whole repo, but maybe it doesn't matter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea I guessed so :p I didn't see myself downloading a single file without the option to easily upgrade: I'd do either pip or a git clone



# Change = str
# sync_deps(from_deps: Dict, to_deps: Dict) -> (List[Change], Dict)
Copy link
Contributor

Choose a reason for hiding this comment

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

we can use actual mypy comments here like this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

{
"elm-lang/core": "4.0.5"
}
'''
Copy link
Contributor

Choose a reason for hiding this comment

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

generally I stick to double quotes for docstrings as per PEP 257

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

(messages, new_deps) = elm_package.sync_deps(top_level, spec)
spec = new_deps

if len(messages) > 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

🎨 maybe flip this -> if len(messages) == 0: print and return

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

if len(messages) > 0:
print('{number} packages changed.'.format(number=len(messages)))

if not dry:
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe also flip this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

from urllib.request import urlopen
except ImportError:
# Fall back to Python 2's urllib2
from urllib2 import urlopen
Copy link
Contributor

Choose a reason for hiding this comment

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

💯

'version': version
})

return result


def format_vendor_dir(base, namespace):
def ensure_vendor_user_dir(base, user):
Copy link
Contributor

Choose a reason for hiding this comment

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

techincally it's not just user - it's also org (hence namespace)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tried renaming to owner

Copy link
Contributor

@eeue56 eeue56 left a comment

Choose a reason for hiding this comment

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

only small changes but otherwise looks good!

@ento
Copy link
Contributor Author

ento commented Nov 16, 2016

@eeue56 add some commits. look reasonable now?

Copy link
Contributor

@eeue56 eeue56 left a comment

Choose a reason for hiding this comment

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

great stuff!

@ento
Copy link
Contributor Author

ento commented Nov 17, 2016

thanks!

@ento ento merged commit 8701cf7 into master Nov 17, 2016
@ento ento deleted the native-deps-sync branch November 17, 2016 22:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants