Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

rearranging code into a proper python package, per #1 #297

Merged
merged 4 commits into from
Apr 22, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
language: python
python:
- "2.7"
install: pip install tox
install:
- pip install tox
- pip install .
script: tox
before_install:
- sudo apt-get update
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ RUN cd /tmp; wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.p
RUN cd /tmp; python ez_setup.py; easy_install pip; \
rm ez_setup.py

ADD requirements.txt /docker-registry/
RUN cd /docker-registry && pip install -r requirements.txt

ADD . /docker-registry
ADD ./config/boto.cfg /etc/boto.cfg

RUN pip install /docker-registry/

RUN cp --no-clobber /docker-registry/config/config_sample.yml /docker-registry/config/config.yml

EXPOSE 5000
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ sudo apt-get install build-essential python-dev libevent-dev python-pip libssl-d
Then install the Registry app:

```
sudo pip install -r requirements.txt
sudo pip install .
```

#### On Red Hat-based systems:
Expand All @@ -292,7 +292,7 @@ should not require the additional repositories.
Then install the Registry app:

```
sudo python-pip install -r requirements.txt
sudo python-pip install .
```

#### Run it
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cd $SERVICE_APPROOT
. ~/env/bin/activate

[ -f requirements.txt ] &&
pip install --download-cache=~/.pip-cache -r requirements.txt || exit 1
pip install --download-cache=~/.pip-cache . || exit 1

cp -R * ~/

Expand Down
2 changes: 1 addition & 1 deletion registry/__init__.py → docker_registry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .images import *
from .status import *

import config
from docker_registry.lib import config

cfg = config.load()
if cfg.standalone is not False:
Expand Down
6 changes: 3 additions & 3 deletions registry/app.py → docker_registry/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
bugsnag = None
import flask

import config
import toolkit
from docker_registry.lib import config
from docker_registry import toolkit


VERSION = '0.6.6'
VERSION = '0.6.7'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm making some assumptions here about your release process. I'm happy to undo this or change it to a different version if that's preferable.

app = flask.Flask('docker-registry')
cfg = config.load()
loglevel = getattr(logging, cfg.get('loglevel', 'INFO').upper())
Expand Down
14 changes: 7 additions & 7 deletions registry/images.py → docker_registry/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
import flask
import simplejson as json

import checksums
import mirroring
import storage
import toolkit
from docker_registry.lib import checksums
from docker_registry.lib import layers
from docker_registry.lib import mirroring
from docker_registry import storage
from docker_registry.storage import local
from docker_registry import toolkit

from .app import app
from .app import cfg
import layers

import storage.local
store = storage.load()
logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -60,7 +60,7 @@ def _get_image_layer(image_id, headers=None, bytes_range=None):
accel_uri_prefix = cfg.nginx_x_accel_redirect
path = store.image_layer_path(image_id)
if accel_uri_prefix:
if isinstance(store, storage.local.LocalStorage):
if isinstance(store, local.LocalStorage):
accel_uri = '/'.join([accel_uri_prefix, path])
headers['X-Accel-Redirect'] = accel_uri
logger.debug('send accelerated {0} ({1})'.format(
Expand Down
10 changes: 5 additions & 5 deletions registry/index.py → docker_registry/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import flask
import simplejson as json

import config
import mirroring
import signals
import storage
import toolkit
from docker_registry.lib import config
from docker_registry.lib import mirroring
from docker_registry.lib import signals
from docker_registry import storage
from docker_registry import toolkit

from .app import app

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/cache.py → docker_registry/lib/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import redis

import config
from . import config


# Default options
Expand Down
2 changes: 1 addition & 1 deletion lib/cache_lru.py → docker_registry/lib/cache_lru.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import redis

import config
from . import config


# Default options
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/config.py → docker_registry/lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def load():
data = None
config_path = os.environ.get('DOCKER_REGISTRY_CONFIG', 'config.yml')
if not os.path.isabs(config_path):
config_path = os.path.join(os.path.dirname(__file__), '..',
config_path = os.path.join(os.path.dirname(__file__), '../../',
'config', config_path)
with open(config_path) as f:
data = yaml.load(f)
Expand Down
7 changes: 4 additions & 3 deletions lib/layers.py → docker_registry/lib/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import backports.lzma as lzma
import simplejson as json

import cache
import rqueue
import storage.local
from . import cache
from . import rqueue
from docker_registry import storage

store = storage.load()

FILE_TYPES = {
Expand Down
8 changes: 4 additions & 4 deletions lib/mirroring.py → docker_registry/lib/mirroring.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import logging
import requests

import cache
import config
import registry.toolkit as toolkit
import storage
from . import cache
from . import config
from docker_registry import storage
from docker_registry import toolkit


DEFAULT_CACHE_TAGS_TTL = 48 * 3600
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions registry/status.py → docker_registry/status.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
__all__ = ['registry_status']

import socket
import sys

import gevent.monkey
gevent.monkey.patch_all()

import cache
import config
import gevent
import socket
import storage
import sys
import toolkit
from docker_registry.lib import cache
from docker_registry.lib import config
from docker_registry import storage
from docker_registry import toolkit

from .app import app

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import tempfile

import config
from docker_registry.lib import config


__all__ = ['load']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import os
import tempfile

import cache_lru
from docker_registry.lib import cache_lru

from . import Storage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import itertools
import logging

import cache_lru
from docker_registry.lib import cache_lru

from . import Storage

Expand Down
2 changes: 1 addition & 1 deletion lib/storage/gcs.py → docker_registry/storage/gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import boto.gs.connection
import boto.gs.key

import cache_lru
from docker_registry.lib import cache_lru

from boto_base import BotoStorage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import glanceclient
from keystoneclient.v2_0 import client as keystoneclient

import signals
from docker_registry.lib import signals

from . import Storage
from .local import LocalStorage
Expand Down
2 changes: 1 addition & 1 deletion lib/storage/local.py → docker_registry/storage/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import shutil

import cache_lru
from docker_registry.lib import cache_lru

from . import Storage

Expand Down
2 changes: 1 addition & 1 deletion lib/storage/s3.py → docker_registry/storage/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import boto.s3.connection
import boto.s3.key

import cache_lru
from docker_registry.lib import cache_lru

from boto_base import BotoStorage

Expand Down
2 changes: 1 addition & 1 deletion lib/storage/swift.py → docker_registry/storage/swift.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import cache_lru
from docker_registry.lib import cache_lru
import swiftclient

from . import Storage
Expand Down
8 changes: 4 additions & 4 deletions registry/tags.py → docker_registry/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import flask
import simplejson as json

import mirroring
import signals
import storage
import toolkit
from docker_registry.lib import mirroring
from docker_registry.lib import signals
from docker_registry import storage
from docker_registry import toolkit

from .app import app

Expand Down
4 changes: 2 additions & 2 deletions registry/toolkit.py → docker_registry/toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import rsa
import simplejson as json

import config
import storage
from docker_registry.lib import config
from docker_registry import storage


logger = logging.getLogger(__name__)
Expand Down
6 changes: 1 addition & 5 deletions scripts/create_ancestry.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
#!/usr/bin/env python

import hashlib
import os
import sys

import simplejson as json

root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(os.path.join(root_path, 'lib'))

import storage
from docker_registry import storage


store = storage.load()
Expand Down
13 changes: 4 additions & 9 deletions scripts/diff-worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@
import argparse
import logging
import os
import sys

import redis

root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(root_path)
sys.path.append(os.path.join(root_path, 'lib'))

import layers
import rlock
import rqueue
import storage
from docker_registry.lib import layers
from docker_registry.lib import rlock
from docker_registry.lib import rqueue
from docker_registry import storage

store = storage.load()

Expand Down
6 changes: 1 addition & 5 deletions scripts/dump_repos_data.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#!/usr/bin/env python

import os
import sys

import simplejson as json

root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(os.path.join(root_path, 'lib'))

import storage
from docker_registry import storage

store = storage.load()

Expand Down
6 changes: 1 addition & 5 deletions scripts/import_old_tags.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#!/usr/bin/env python

import os
import sys

root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(os.path.join(root_path, 'lib'))

import storage
from docker_registry import storage


# Copy/Pasted from old models
Expand Down
Loading