mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-04 22:40:29 +03:00
Merge branch 'master' into 'master'
Add support for the new Bitbucket look See merge request !278
This commit is contained in:
commit
63fd20fff0
1 changed files with 13 additions and 2 deletions
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
import binascii
|
import binascii
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
|
@ -39,9 +40,19 @@ def getrepofrompage(url):
|
||||||
req = urllib.request.urlopen(url)
|
req = urllib.request.urlopen(url)
|
||||||
if req.getcode() != 200:
|
if req.getcode() != 200:
|
||||||
return (None, 'Unable to get ' + url + ' - return code ' + str(req.getcode()))
|
return (None, 'Unable to get ' + url + ' - return code ' + str(req.getcode()))
|
||||||
page = req.read()
|
page = req.read().decode(req.headers.get_content_charset())
|
||||||
|
|
||||||
# Works for BitBucket
|
# Works for BitBucket
|
||||||
|
m = re.search('data-fetch-url="(.*)"', page)
|
||||||
|
if m is not None:
|
||||||
|
repo = m.group(1)
|
||||||
|
|
||||||
|
if repo.endswith('.git'):
|
||||||
|
return ('git', repo)
|
||||||
|
|
||||||
|
return ('hg', repo)
|
||||||
|
|
||||||
|
# Works for BitBucket (obsolete)
|
||||||
index = page.find('hg clone')
|
index = page.find('hg clone')
|
||||||
if index != -1:
|
if index != -1:
|
||||||
repotype = 'hg'
|
repotype = 'hg'
|
||||||
|
|
@ -53,7 +64,7 @@ def getrepofrompage(url):
|
||||||
repo = repo.split('"')[0]
|
repo = repo.split('"')[0]
|
||||||
return (repotype, repo)
|
return (repotype, repo)
|
||||||
|
|
||||||
# Works for BitBucket
|
# Works for BitBucket (obsolete)
|
||||||
index = page.find('git clone')
|
index = page.find('git clone')
|
||||||
if index != -1:
|
if index != -1:
|
||||||
repotype = 'git'
|
repotype = 'git'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue