Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'packaginator/master'

  • Loading branch information...
commit a4892c4200cb3487d98cc5cd8d8d16d8ebf428d3 2 parents c58460f + 942bf7e
@FlaviuSim FlaviuSim authored
View
8 apps/package/repos/__init__.py
@@ -1,5 +1,8 @@
+from django.conf import settings
+
import re
+
def get_all_repos():
return (get_repo(repo_id) for repo_id in supported_repos())
@@ -16,4 +19,7 @@ def get_repo_for_repo_url(repo_url):
return unsupported_handler
def supported_repos():
- return ["bitbucket", "github", "launchpad"]
+ supported = ["bitbucket", "github"]
+ if settings.LAUNCHPAD_ACTIVE:
+ supported += ["launchpad"]
+ return supported
View
18 apps/package/tests/test_pulls.py
@@ -1,3 +1,4 @@
+from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
@@ -26,13 +27,14 @@ def setUp(self):
)
package.save()
- package = Package.objects.create(
- title="Django-PreFlight",
- slug="django-preflight",
- repo_url="https://code.launchpad.net/~canonical-isd-hackers/django-preflight/trunk",
- pypi_url="django-preflight"
- )
- package.save()
+ if settings.LAUNCHPAD_ACTIVE:
+ package = Package.objects.create(
+ title="Django-PreFlight",
+ slug="django-preflight",
+ repo_url="https://code.launchpad.net/~canonical-isd-hackers/django-preflight/trunk",
+ pypi_url="django-preflight"
+ )
+ package.save()
# package list is needed throughout the app
self.packages = Package.objects.all()
@@ -107,4 +109,4 @@ def test_package_model_fetch(self):
self.assertTrue(package.repo_description)
# TODO check if this is getting updated
- #self.assertTrue(package.participants)
+ #self.assertTrue(package.participants)
View
48 apps/package/tests/test_repos.py
@@ -1,5 +1,6 @@
# TODO: mock these tests so no network access is required
+from django.conf import settings
from django.test import TestCase
from package.repos.bitbucket import repo_handler as bitbucket_handler
@@ -58,23 +59,24 @@ def test_fetch_metadata(self):
self.package.fetch_commits()
-class TestLaunchpadRepo(TestCase):
- def setUp(self):
- self.package = Package.objects.create(
- title="Django-PreFlight",
- slug="django-preflight",
- repo_url="https://code.launchpad.net/~canonical-isd-hackers/django-preflight/trunk")
-
- def test_fetch_commits(self):
- self.assertEqual(Commit.objects.count(), 0)
- launchpad_handler.fetch_commits(self.package)
- self.assertNotEqual(Commit.objects.count(), 0)
-
- def test_fetch_metadata(self):
- package = launchpad_handler.fetch_metadata(self.package)
- self.assertTrue(package.repo_watchers > 0)
- self.assertTrue(package.repo_forks > 0)
- self.assertEqual(package.participants, 'canonical-isd-hackers')
+if settings.LAUNCHPAD_ACTIVE:
+ class TestLaunchpadRepo(TestCase):
+ def setUp(self):
+ self.package = Package.objects.create(
+ title="Django-PreFlight",
+ slug="django-preflight",
+ repo_url="https://code.launchpad.net/~canonical-isd-hackers/django-preflight/trunk")
+
+ def test_fetch_commits(self):
+ self.assertEqual(Commit.objects.count(), 0)
+ launchpad_handler.fetch_commits(self.package)
+ self.assertNotEqual(Commit.objects.count(), 0)
+
+ def test_fetch_metadata(self):
+ package = launchpad_handler.fetch_metadata(self.package)
+ self.assertTrue(package.repo_watchers > 0)
+ self.assertTrue(package.repo_forks > 0)
+ self.assertEqual(package.participants, 'canonical-isd-hackers')
'''
class TestSourceforgeRepo(TestCase):
@@ -103,12 +105,12 @@ def test_repo_registry(self):
g = get_repo("github")
self.assertEqual(g.title, "Github")
self.assertEqual(g.url, "https://github.com")
-
- l = get_repo("launchpad")
- self.assertEqual(l.title, "Launchpad")
- self.assertEqual(l.url, "https://code.launchpad.net")
-
self.assertTrue("github" in supported_repos())
- self.assertTrue("launchpad" in supported_repos())
+
+ if settings.LAUNCHPAD_ACTIVE:
+ l = get_repo("launchpad")
+ self.assertEqual(l.title, "Launchpad")
+ self.assertEqual(l.url, "https://code.launchpad.net")
+ self.assertTrue("launchpad" in supported_repos())
self.assertRaises(ImportError, lambda: get_repo("xyzzy"))
View
4 docs/install.rst
@@ -69,6 +69,10 @@ Change the ``ROOT_URLS`` setting in ``local_settings.py`` from `<root_directory_
ROOT_URLCONF = '<root_directory_name>.urls'
+You can enable launchpad support in the local settings file. Launchpad's dependencies can be a little fussy, so this will probably require some additional tweaking on your part::
+
+ LAUNCHPAD_ACTIVE = True
+
Add a Google Analytics code if you have one::
URCHIN_ID = "UA-YOURID123-1"
View
2  local_settings.py.example
@@ -27,6 +27,8 @@ LOCAL_INSTALLED_APPS = []
ROOT_URLCONF = "packaginator.urls"
+LAUNCHPAD_ACTIVE = False
+
# Analytics ID
URCHIN_ID = ""
View
2  settings.py
@@ -272,8 +272,8 @@
"""
}
-#: See http://ask.github.com/celery/configuration.html
CELERYD_TASK_TIME_LIMIT = 300
+LAUNCHPAD_ACTIVE = False
LOCAL_INSTALLED_APPS = []
Please sign in to comment.
Something went wrong with that request. Please try again.