summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cerbero/enums.py3
-rw-r--r--cerbero/utils/shell.py11
-rw-r--r--setup.py3
3 files changed, 12 insertions, 5 deletions
diff --git a/cerbero/enums.py b/cerbero/enums.py
index 4b7b015c..8a27f512 100644
--- a/cerbero/enums.py
+++ b/cerbero/enums.py
@@ -19,6 +19,9 @@
from cerbero.errors import FatalError
+# Safest place to define this since this file imports very few modules
+CERBERO_VERSION = '1.17.1.1'
+
class Platform:
''' Enumeration of supported platforms '''
LINUX = 'linux'
diff --git a/cerbero/utils/shell.py b/cerbero/utils/shell.py
index 0cc6e898..a8a8896b 100644
--- a/cerbero/utils/shell.py
+++ b/cerbero/utils/shell.py
@@ -35,12 +35,13 @@ import collections
from pathlib import Path, PurePath
from distutils.version import StrictVersion
-from cerbero.enums import Platform
+from cerbero.enums import CERBERO_VERSION, Platform
from cerbero.utils import _, system_info, to_unixpath, determine_num_of_cpus, CerberoSemaphore
from cerbero.utils import messages as m
from cerbero.errors import CommandError, FatalError
+USER_AGENT = 'GStreamer Cerbero/' + CERBERO_VERSION
PATCH = 'patch'
TAR = 'tar'
TARBALL_SUFFIXES = ('tar.gz', 'tgz', 'tar.bz2', 'tbz2', 'tar.xz')
@@ -343,7 +344,7 @@ async def download_wget(url, destination=None, check_cert=True, overwrite=False,
@param destination: destination where the file will be saved
@type destination: str
'''
- cmd = ['wget', url]
+ cmd = ['wget', '--user-agent', USER_AGENT, url]
path = None
if destination is not None:
cmd += ['-O', destination]
@@ -381,7 +382,9 @@ async def download_urllib2(url, destination=None, check_cert=True, overwrite=Fal
try:
with open(destination, 'wb') as d:
- f = urllib.request.urlopen(url, context=ctx)
+ req = urllib.request.Request(url)
+ req.add_header('User-Agent', USER_AGENT)
+ f = urllib.request.urlopen(req, context=ctx)
d.write(f.read())
except urllib.error.HTTPError as e:
if os.path.exists(destination):
@@ -398,7 +401,7 @@ async def download_curl(url, destination=None, check_cert=True, overwrite=False,
@type destination: str
'''
path = None
- cmd = ['curl', '-L', '--fail', '--retry', '2']
+ cmd = ['curl', '-L', '--fail', '--retry', '2', '--user-agent', USER_AGENT]
if not check_cert:
cmd += ['-k']
if destination is not None:
diff --git a/setup.py b/setup.py
index 715309de..8bb1863c 100644
--- a/setup.py
+++ b/setup.py
@@ -4,6 +4,7 @@ import shutil
from setuptools import setup, find_packages
from setuptools.command import sdist as setuptools_sdist
from cerbero.utils import shell
+from cerbero.enums import CERBERO_VERSION
from distutils.dir_util import copy_tree
import distutils.log
@@ -127,7 +128,7 @@ class extended_sdist(setuptools_sdist.sdist):
setup(
name = "cerbero",
- version = '1.17.1.1',
+ version = CERBERO_VERSION,
author = "Andoni Morales",
author_email = "amorales@fluendo.com",
description = ("Multi platform build system for Open Source projects"),