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

Change gcloud package to google.cloud #2223

Merged
merged 24 commits into from
Sep 7, 2016

Commits on Sep 6, 2016

  1. Renaming gcloud/ directory to google/cloud/.

    Done via:
    
    $ mkdir google
    $ git mv gcloud google/cloud
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    261c969 View commit details
    Browse the repository at this point in the history
  2. Renaming "import gcloud" statements as google.cloud.

    Done via:
    
    $ git grep -l 'import gcloud' | \
    > xargs sed -i s/'import gcloud'/'import google.cloud'/g
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    e55a1d8 View commit details
    Browse the repository at this point in the history
  3. Renaming "from gcloud import *" statements as google.cloud.

    Done via:
    
    $ git grep -l 'from gcloud import' | \
    > xargs sed -i s/'from gcloud import'/'from google.cloud import'/g
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    416071b View commit details
    Browse the repository at this point in the history
  4. Renaming ">>> from gcloud.foo.bar import *" statements as google.cloud.

    Done via:
    
    $ git grep -l '>>> from gcloud.' | \
    > xargs sed -i s/'>>> from gcloud.'/'>>> from google.cloud.'/g
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    835578f View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d05a9d4 View commit details
    Browse the repository at this point in the history
  6. Rename remaining "gcloud" imports as "google.cloud".

    This was done entirely via sed. First checked that
    the remaining imports were at the start of their
    respective lines:
    
    $ git grep 'from gcloud.*import' > anywhere.txt
    $ git grep '^[[:space:]]*from gcloud.*import' > line_start.txt
    $ diff -s anywhere.txt line_start.txt
    Files anywhere.txt and line_start.txt are identical
    $ rm -f anywhere.txt line_start.txt
    
    Then put all the imports in a text file
    
    $ git grep -h '^[[:space:]]*from gcloud.*import' > imports.txt
    
    Then parsed that file to get a list of the modules:
    
    $ cat << EOF > get_mods.py
    > def get_import(line):
    >     a, b, c, d = line.strip().split(None, 3)
    >     assert a == 'from'
    >     assert c == 'import'
    >     try:
    >         e, f, g = b.split('.', 2)
    >     except ValueError:
    >         e, f = b.split('.')
    >     assert e == 'gcloud'
    >     return f
    >
    > with open('imports.txt', 'rb') as file_obj:
    >     imported = sorted(set(map(get_import, file_obj.readlines())))
    >
    > for mod in imported:
    >     print(mod)
    >
    > EOF
    $ python get_mods.py > mods.txt
    $ rm -f imports.txt get_mods.py
    
    Then using the list of modules to rewrite the imports
    
    $ cat << 'EOF' > all-sed.sh
    > for mod in $(cat mods.txt); do
    >     git grep -l "from gcloud.${mod}" | \
    >     xargs sed -i s/"from gcloud.${mod}"/"from google.cloud.${mod}"/g
    > done
    >
    > EOF
    $ /bin/bash all-sed.sh
    $ rm -f all-sed.sh mods.txt
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    822e719 View commit details
    Browse the repository at this point in the history
  7. Renaming mentions of "gcloud-python" as "google-cloud-python".

    Done via:
    
    $ git grep -l 'gcloud-python' | \
    > xargs sed -i s/gcloud-python/google-cloud-python/g
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    ab18ce8 View commit details
    Browse the repository at this point in the history
  8. Renaming mentions of "hack-on-gcloud" as "hack-on-google-cloud-python".

    Done via:
    
    $ git grep -l 'hack-on-gcloud' | \
    > xargs sed -i s/hack-on-gcloud/hack-on-google-cloud-python/g
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    c13d2ec View commit details
    Browse the repository at this point in the history
  9. Renaming mentions of "gcloud" docs automodules as "google.cloud".

    Done via:
    
    $ git grep -l 'automodule:: gcloud' | \
    > xargs sed -i s/'automodule:: gcloud'/'automodule:: google.cloud'/g
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    f29999a View commit details
    Browse the repository at this point in the history
  10. Renaming docs mentions of "gcloud" as "google-cloud".

    Done via:
    
    $ git grep -l '<gcloud.' | \
    > xargs sed -i s/'<gcloud.'/'<google.cloud.'/g
    
    $ git grep -l '`gcloud\.' | \
    > xargs sed -i s/'`gcloud\.'/'`google.cloud.'/g
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    f12fee4 View commit details
    Browse the repository at this point in the history
  11. Renaming docs path in JSON docs (gcloud->google/cloud).

    Done via:
    
    $ git grep -l '"gcloud/' | \
    > xargs sed -i s/'"gcloud\/'/'"google\/cloud\/'/g
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    ae89f77 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    381d236 View commit details
    Browse the repository at this point in the history
  13. Replacing gcloud with google-cloud in scripts directory.

    Many usages were ad-hoc so this was done by hand rather
    than via a sed script.
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    3649f3a View commit details
    Browse the repository at this point in the history
  14. Renaming all GCLOUD_* env. vars. as GOOGLE_CLOUD_*.

    Done via:
    
    $ git grep -l 'GCLOUD_' | \
    > xargs sed -i s/'GCLOUD_'/'GOOGLE_CLOUD_'/g
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    ab59f8d View commit details
    Browse the repository at this point in the history
  15. Renaming all GCloudError as GoogleCloudError.

    Done via:
    
    $ git grep -l GCloudError | \
    > xargs sed -i s/GCloudError/GoogleCloudError/g
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    e12cc95 View commit details
    Browse the repository at this point in the history
  16. Renaming all ~gcloud references as google.cloud.

    Done via:
    
    $ git grep -l '~gcloud' | \
    > xargs sed -i s/'~gcloud'/'~google.cloud'/g
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    faab61c View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    5910b22 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    e6139ac View commit details
    Browse the repository at this point in the history
  19. Adding __init__.py to make google/ a package.

    commit 6faf161
    Author: Danny Hermes <[email protected]>
    Date:   Tue Aug 30 12:39:46 2016 -0700
    
    Converting almost all packages to namespace packages.
    
    As a result, the module objects for those packages can no longer
    contain members. Hence the following is no longer possible:
    
    >>> from google.cloud import storage
    >>> client = storage.Client()
    
    The "_generated" packages have not been converted to namespace
    packages and neither have "google.cloud.logging.handlers"
    nor "google.cloud.logging.handlers.transports".
    
    In addition, some members of "google.cloud.logging" have been
    moved into "google.cloud.logging.client" in order to be
    importable.
    
    Finally, the unit tests all pass at this commit, but `tox`
    fails to run them: the namespace imports appear broken to
    `tox` even though they aren't broken to the `virtualenv`
    for the given `tox` environment.
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    73d2986 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    adf5e21 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    e03a7f8 View commit details
    Browse the repository at this point in the history
  22. Updating coveragerc omit section for namespace collisions.

    In particular, omitting "google.cloud.logging.v2" and
    "google.cloud.pubsub.v1" since they are in our "google.cloud" namespace
    package but are not owned by us.
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    c2c9f4d View commit details
    Browse the repository at this point in the history
  23. Restoring most services as non-namespace packages.

    For now, logging and pubsub will remain due to
    collision with the GAX generated names.
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    4534d9a View commit details
    Browse the repository at this point in the history
  24. Removing json-docs from Travis config.

    This is a temporary change since the JSON docs
    are in a state of flux. The rename slightly breaks
    the JSON docs, but it isn't worth patching during
    this change set.
    dhermes committed Sep 6, 2016
    Configuration menu
    Copy the full SHA
    fee8d0d View commit details
    Browse the repository at this point in the history