def build_targets(): for pyver in PY_VERSIONS: run_setup("bdist_egg", pyver) built_files.append("dist/%s-%s-py%s.egg" % (PACKAGE_NAME, get_package_version(), pyver)) run_setup("sdist") built_files.append("dist/%s-%s.tar.gz" % (PACKAGE_NAME, get_package_version()))
def __init__(self, url, info, cookie_file): self.url = url if self.url[-1] != '/': self.url += '/' self._info = info self._server_info = None self.root_resource = None self.deprecated_api = False self.cookie_file = cookie_file self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file) if self.cookie_file: try: self.cookie_jar.load(self.cookie_file, ignore_expires=True) except IOError: pass # Set up the HTTP libraries to support all of the features we need. cookie_handler = urllib2.HTTPCookieProcessor(self.cookie_jar) password_mgr = ReviewBoardHTTPPasswordMgr(self.url, options.username, options.password) basic_auth_handler = ReviewBoardHTTPBasicAuthHandler(password_mgr) digest_auth_handler = urllib2.HTTPDigestAuthHandler(password_mgr) self.preset_auth_handler = PresetHTTPAuthHandler(self.url, password_mgr) http_error_processor = ReviewBoardHTTPErrorProcessor() opener = urllib2.build_opener(cookie_handler, basic_auth_handler, digest_auth_handler, self.preset_auth_handler, http_error_processor) opener.addheaders = [('User-agent', 'RBTools/' + get_package_version())] urllib2.install_opener(opener)
def __init__(self, server_url, cookie_path_file=None, password_mgr=None): self.server_url = server_url if cookie_path_file: self.cookie_file = cookie_path_file #if not os.path.isfile(cookie_path_file): # temp_file = open(cookie_path_file, 'w') # temp_file.close() #self.cookie_file = cookie_path_file else: self.cookie_file = '.default_cookie' if password_mgr and \ isinstance(password_mgr, ReviewBoardHTTPPasswordMgr): self.password_mgr = password_mgr else: self.password_mgr = ReviewBoardHTTPPasswordMgr(self.server_url) self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file) if os.path.isfile(self.cookie_file): self.cookie_jar.load() cookie_handler = urllib2.HTTPCookieProcessor(self.cookie_jar) basic_auth_handler = urllib2.HTTPBasicAuthHandler(self.password_mgr) digest_auth_handler = urllib2.HTTPDigestAuthHandler(self.password_mgr) opener = urllib2.build_opener(cookie_handler, basic_auth_handler, digest_auth_handler) opener.addheaders = [ ('User-agent', 'RBTools/' + get_package_version()) ] urllib2.install_opener(opener)
def __init__(self, url, info, cookie_file): self.url = url if self.url[-1] != '/': self.url += '/' self._info = info self._server_info = None self.root_resource = None self.deprecated_api = False self.cookie_file = cookie_file self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file) if self.cookie_file: try: self.cookie_jar.load(self.cookie_file, ignore_expires=True) except IOError: pass # Set up the HTTP libraries to support all of the features we need. cookie_handler = urllib2.HTTPCookieProcessor(self.cookie_jar) password_mgr = ReviewBoardHTTPPasswordMgr(self.url, options.username, options.password) basic_auth_handler = ReviewBoardHTTPBasicAuthHandler(password_mgr) digest_auth_handler = urllib2.HTTPDigestAuthHandler(password_mgr) self.preset_auth_handler = PresetHTTPAuthHandler( self.url, password_mgr) http_error_processor = ReviewBoardHTTPErrorProcessor() opener = urllib2.build_opener(cookie_handler, basic_auth_handler, digest_auth_handler, self.preset_auth_handler, http_error_processor) opener.addheaders = [('User-agent', 'RBTools/' + get_package_version()) ] urllib2.install_opener(opener)
def __init__(self, url, info, cookie_file): self.url = url if self.url[-1] != '/': self.url += '/' self._info = info self._server_info = None self.root_resource = None self.deprecated_api = False self.cookie_file = cookie_file self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file) if self.cookie_file: try: self.cookie_jar.load(self.cookie_file, ignore_expires=True) except IOError: pass # Set up the HTTP libraries to support all of the features we need. password_mgr = ReviewBoardHTTPPasswordMgr(self.url, options.username, options.password) self.preset_auth_handler = PresetHTTPAuthHandler( self.url, password_mgr) handlers = [] if options.disable_proxy: debug('Disabling HTTP(s) proxy support') handlers.append(urllib2.ProxyHandler({})) handlers += [ urllib2.HTTPCookieProcessor(self.cookie_jar), ReviewBoardHTTPBasicAuthHandler(password_mgr), urllib2.HTTPDigestAuthHandler(password_mgr), self.preset_auth_handler, ReviewBoardHTTPErrorProcessor(), ] opener = urllib2.build_opener(*handlers) opener.addheaders = [('User-agent', 'RBTools/' + get_package_version()) ] urllib2.install_opener(opener)
def __init__(self, url, info, cookie_file): self.url = url if self.url[-1] != '/': self.url += '/' self._info = info self._server_info = None self.root_resource = None self.deprecated_api = False self.rb_version = "0.0.0.0" self.cookie_file = cookie_file self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file) if self.cookie_file: try: self.cookie_jar.load(self.cookie_file, ignore_expires=True) except IOError: pass # Set up the HTTP libraries to support all of the features we need. password_mgr = ReviewBoardHTTPPasswordMgr(self.url, options.username, options.password) self.preset_auth_handler = PresetHTTPAuthHandler(self.url, password_mgr) handlers = [] if options.disable_proxy: debug('Disabling HTTP(s) proxy support') handlers.append(urllib2.ProxyHandler({})) handlers += [ urllib2.HTTPCookieProcessor(self.cookie_jar), ReviewBoardHTTPBasicAuthHandler(password_mgr), urllib2.HTTPDigestAuthHandler(password_mgr), self.preset_auth_handler, ReviewBoardHTTPErrorProcessor(), ] opener = urllib2.build_opener(*handlers) opener.addheaders = [('User-agent', 'RBTools/' + get_package_version())] urllib2.install_opener(opener)
def __init__(self, url, cookie_file=None, username=None, password=None, api_token=None, agent=None, session=None, disable_proxy=False, auth_callback=None, otp_token_callback=None, verify_ssl=True, save_cookies=True, ext_auth_cookies=None): if not url.endswith('/'): url += '/' self.url = url + 'api/' self.save_cookies = save_cookies self.ext_auth_cookies = ext_auth_cookies if self.save_cookies: self.cookie_jar, self.cookie_file = create_cookie_jar( cookie_file=cookie_file) try: self.cookie_jar.load(ignore_expires=True) except IOError: pass else: self.cookie_jar = CookieJar() self.cookie_file = None if self.ext_auth_cookies: try: self.cookie_jar.load(ext_auth_cookies, ignore_expires=True) except IOError as e: logging.critical( 'There was an error while loading a ' 'cookie file: %s', e) pass # Get the cookie domain from the url. If the domain # does not contain a '.' (e.g. 'localhost'), we assume # it is a local domain and suffix it (See RFC 2109). parsed_url = urlparse(url) self.domain = parsed_url[1].partition(':')[0] # Remove Port. if self.domain.count('.') < 1: self.domain = '%s.local' % self.domain if session: cookie = Cookie(version=0, name=RB_COOKIE_NAME, value=session, port=None, port_specified=False, domain=self.domain, domain_specified=True, domain_initial_dot=True, path=parsed_url[2], path_specified=True, secure=False, expires=None, discard=False, comment=None, comment_url=None, rest={'HttpOnly': None}) self.cookie_jar.set_cookie(cookie) if self.save_cookies: self.cookie_jar.save() if username: # If the username parameter is given, we have to clear the session # cookie manually or it will override the username:password # combination retrieved from the authentication callback. try: self.cookie_jar.clear(self.domain, parsed_url[2], RB_COOKIE_NAME) except KeyError: pass # Set up the HTTP libraries to support all of the features we need. password_mgr = ReviewBoardHTTPPasswordMgr(self.url, username, password, api_token, auth_callback, otp_token_callback) self.preset_auth_handler = PresetHTTPAuthHandler( self.url, password_mgr) handlers = [] if not verify_ssl: context = ssl._create_unverified_context() handlers.append(HTTPSHandler(context=context)) if disable_proxy: handlers.append(ProxyHandler({})) handlers += [ HTTPCookieProcessor(self.cookie_jar), ReviewBoardHTTPBasicAuthHandler(password_mgr), HTTPDigestAuthHandler(password_mgr), self.preset_auth_handler, ReviewBoardHTTPErrorProcessor(), ] if agent: self.agent = agent else: self.agent = ('RBTools/' + get_package_version()).encode('utf-8') opener = build_opener(*handlers) opener.addheaders = [ (str('User-agent'), str(self.agent)), ] install_opener(opener) self._cache = None self._urlopen = urlopen
except ImportError: install_requires.append("simplejson") rb_commands = [ "attach = rbtools.commands.attach:Attach", "close = rbtools.commands.close:Close", "diff = rbtools.commands.diff:Diff", "patch = rbtools.commands.patch:Patch", "post = rbtools.commands.post:Post", "publish = rbtools.commands.publish:Publish", ] setup( name=PACKAGE_NAME, version=get_package_version(), license="MIT", description="Command line tools for use with Review Board", entry_points={ "console_scripts": ["post-review = rbtools.postreview:main", "rbt = rbtools.commands.main:main"], "rbtools_commands": rb_commands, }, install_requires=install_requires, dependency_links=[download_url], packages=find_packages(), include_package_data=True, maintainer="Christian Hammond", maintainer_email="*****@*****.**", url="http://www.reviewboard.org/", download_url=download_url, classifiers=[
def __init__(self, url, cookie_file=None, username=None, password=None, api_token=None, agent=None, session=None, disable_proxy=False, auth_callback=None, otp_token_callback=None, verify_ssl=True, save_cookies=True): if not url.endswith('/'): url += '/' self.url = url + 'api/' self.save_cookies = save_cookies if self.save_cookies: self.cookie_jar, self.cookie_file = create_cookie_jar( cookie_file=cookie_file) try: self.cookie_jar.load(ignore_expires=True) except IOError: pass else: self.cookie_jar = CookieJar() self.cookie_file = None # Get the cookie domain from the url. If the domain # does not contain a '.' (e.g. 'localhost'), we assume # it is a local domain and suffix it (See RFC 2109). parsed_url = urlparse(url) self.domain = parsed_url[1].partition(':')[0] # Remove Port. if self.domain.count('.') < 1: self.domain = '%s.local' % self.domain if session: cookie = Cookie( version=0, name=RB_COOKIE_NAME, value=session, port=None, port_specified=False, domain=self.domain, domain_specified=True, domain_initial_dot=True, path=parsed_url[2], path_specified=True, secure=False, expires=None, discard=False, comment=None, comment_url=None, rest={'HttpOnly': None}) self.cookie_jar.set_cookie(cookie) if self.save_cookies: self.cookie_jar.save() if username: # If the username parameter is given, we have to clear the session # cookie manually or it will override the username:password # combination retrieved from the authentication callback. try: self.cookie_jar.clear(self.domain, parsed_url[2], RB_COOKIE_NAME) except KeyError: pass # Set up the HTTP libraries to support all of the features we need. password_mgr = ReviewBoardHTTPPasswordMgr(self.url, username, password, api_token, auth_callback, otp_token_callback) self.preset_auth_handler = PresetHTTPAuthHandler(self.url, password_mgr) handlers = [] if not verify_ssl: context = ssl._create_unverified_context() handlers.append(HTTPSHandler(context=context)) if disable_proxy: handlers.append(ProxyHandler({})) handlers += [ HTTPCookieProcessor(self.cookie_jar), ReviewBoardHTTPBasicAuthHandler(password_mgr), HTTPDigestAuthHandler(password_mgr), self.preset_auth_handler, ReviewBoardHTTPErrorProcessor(), ] if agent: self.agent = agent else: self.agent = ('RBTools/' + get_package_version()).encode('utf-8') opener = build_opener(*handlers) opener.addheaders = [ (b'User-agent', self.agent), ] install_opener(opener) self._cache = None self._urlopen = urlopen
(PACKAGE_NAME, VERSION[0], VERSION[1]) else: download_url = "http://downloads.reviewboard.org/nightlies/" install_requires = ['six>=1.8.0'] # Make sure this is a version of Python we are compatible with. This should # prevent people on older versions from unintentionally trying to install # the source tarball, and failing. if sys.hexversion < 0x02050000: sys.stderr.write( 'RBTools %s is incompatible with your version of Python.\n' 'Please install RBTools 0.5.x or upgrade Python to at least ' '2.6.x (preferably 2.7).\n' % get_package_version()) sys.exit(1) elif sys.hexversion < 0x02060000: sys.stderr.write( 'RBTools %s is incompatible with your version of Python.\n' 'Please install RBTools 0.6.x or upgrade Python to at least ' '2.6.x (preferably 2.7).\n' % get_package_version()) sys.exit(1) elif sys.hexversion < 0x02070000: install_requires.append('argparse') rb_commands = [ 'api-get = rbtools.commands.api_get:APIGet', 'attach = rbtools.commands.attach:Attach', 'clear-cache = rbtools.commands.clearcache:ClearCache',
'status = rbtools.commands.status:Status', ] scm_clients = [ 'bazaar = rbtools.clients.bazaar:BazaarClient', 'clearcase = rbtools.clients.clearcase:ClearCaseClient', 'cvs = rbtools.clients.cvs:CVSClient', 'git = rbtools.clients.git:GitClient', 'mercurial = rbtools.clients.mercurial:MercurialClient', 'perforce = rbtools.clients.perforce:PerforceClient', 'plastic = rbtools.clients.plastic:PlasticClient', 'svn = rbtools.clients.svn:SVNClient', ] setup(name=PACKAGE_NAME, version=get_package_version(), license="MIT", description="Command line tools for use with Review Board", entry_points={ 'console_scripts': [ 'post-review = rbtools.postreview:main', 'rbt = rbtools.commands.main:main', ], 'rbtools_commands': rb_commands, 'rbtools_scm_clients': scm_clients, }, install_requires=install_requires, dependency_links=[ download_url,
from __future__ import unicode_literals import sys from setuptools import setup, find_packages from rbtools import get_package_version, is_release, VERSION # Make sure this is a version of Python we are compatible with. This should # prevent people on older versions from unintentionally trying to install # the source tarball, and failing. if sys.hexversion < 0x02050000: sys.stderr.write( 'RBTools %s is incompatible with your version of Python.\n' 'Please install RBTools 0.5.x or upgrade Python to at least ' '2.7.x.\n' % get_package_version()) sys.exit(1) elif sys.hexversion < 0x02060000: sys.stderr.write( 'RBTools %s is incompatible with your version of Python.\n' 'Please install RBTools 0.6.x or upgrade Python to at least ' '2.7.x.\n' % get_package_version()) sys.exit(1) elif sys.hexversion < 0x02070000: sys.stderr.write( 'RBTools %s is incompatible with your version of Python.\n' 'Please install RBTools 0.7.x or upgrade Python to at least ' '2.7.x.\n' % get_package_version()) sys.exit(1) elif 0x03000000 <= sys.hexversion < 0x03050000: sys.stderr.write(
import sys from setuptools import setup, find_packages from rbtools import get_package_version, is_release, VERSION # Make sure this is a version of Python we are compatible with. This should # prevent people on older versions from unintentionally trying to install # the source tarball, and failing. if sys.hexversion < 0x02050000: sys.stderr.write( 'RBTools %s is incompatible with your version of Python.\n' 'Please install RBTools 0.5.x or upgrade Python to at least ' '2.7.x.\n' % get_package_version()) sys.exit(1) elif sys.hexversion < 0x02060000: sys.stderr.write( 'RBTools %s is incompatible with your version of Python.\n' 'Please install RBTools 0.6.x or upgrade Python to at least ' '2.7.x.\n' % get_package_version()) sys.exit(1) elif sys.hexversion < 0x02070000: sys.stderr.write( 'RBTools %s is incompatible with your version of Python.\n' 'Please install RBTools 0.7.x or upgrade Python to at least ' '2.7.x.\n' % get_package_version()) sys.exit(1) elif 0x03000000 <= sys.hexversion < 0x03050000: sys.stderr.write(
def tag_release(): execute("git tag release-%s" % get_package_version())
import sys from setuptools import setup, find_packages from rbtools import get_package_version, is_release, VERSION # Make sure this is a version of Python we are compatible with. This should # prevent people on older versions from unintentionally trying to install # the source tarball, and failing. if sys.hexversion < 0x02050000: sys.stderr.write( 'RBTools %s is incompatible with your version of Python.\n' 'Please install RBTools 0.5.x or upgrade Python to at least ' '2.7.x.\n' % get_package_version()) sys.exit(1) elif sys.hexversion < 0x02060000: sys.stderr.write( 'RBTools %s is incompatible with your version of Python.\n' 'Please install RBTools 0.6.x or upgrade Python to at least ' '2.7.x.\n' % get_package_version()) sys.exit(1) elif sys.hexversion < 0x02070000: sys.stderr.write( 'RBTools %s is incompatible with your version of Python.\n' 'Please install RBTools 0.7.x or upgrade Python to at least ' '2.7.x.\n' % get_package_version()) sys.exit(1) elif 0x03000000 <= sys.hexversion < 0x03060000: sys.stderr.write(
if is_release(): download_url = "http://downloads.reviewboard.org/releases/%s/%s.%s/" % \ (PACKAGE_NAME, VERSION[0], VERSION[1]) else: download_url = "http://downloads.reviewboard.org/nightlies/" install_requires = ['six>=1.8.0'] # Make sure this is a version of Python we are compatible with. This should # prevent people on older versions from unintentionally trying to install # the source tarball, and failing. if sys.hexversion < 0x02050000: sys.stderr.write( 'RBTools %s is incompatible with your version of Python.\n' 'Please install RBTools 0.5.x or upgrade Python to at least ' '2.6.x (preferably 2.7).\n' % get_package_version()) sys.exit(1) elif sys.hexversion < 0x02060000: sys.stderr.write( 'RBTools %s is incompatible with your version of Python.\n' 'Please install RBTools 0.6.x or upgrade Python to at least ' '2.6.x (preferably 2.7).\n' % get_package_version()) sys.exit(1) elif sys.hexversion < 0x02070000: install_requires.append('argparse') rb_commands = [ 'api-get = rbtools.commands.api_get:APIGet', 'attach = rbtools.commands.attach:Attach', 'clear-cache = rbtools.commands.clearcache:ClearCache', 'close = rbtools.commands.close:Close',
def __init__(self, url, cookie_file=None, username=None, password=None, agent=None, session=None, disable_proxy=False, auth_callback=None): self.url = url if self.url[-1] != '/': self.url += '/' self.url = self.url + 'api/' self.cookie_jar, self.cookie_file = create_cookie_jar( cookie_file=cookie_file) try: self.cookie_jar.load(ignore_expires=True) except IOError: pass if session: parsed_url = urlparse(url) # Get the cookie domain from the url. If the domain # does not contain a '.' (e.g. 'localhost'), we assume # it is a local domain and suffix it (See RFC 2109). domain = parsed_url[1].partition(':')[0] # Remove Port. if domain.count('.') < 1: domain = "%s.local" % domain cookie = cookielib.Cookie( version=0, name=RB_COOKIE_NAME, value=session, port=None, port_specified=False, domain=domain, domain_specified=True, domain_initial_dot=True, path=parsed_url[2], path_specified=True, secure=False, expires=None, discard=False, comment=None, comment_url=None, rest={'HttpOnly': None}) self.cookie_jar.set_cookie(cookie) self.cookie_jar.save() # Set up the HTTP libraries to support all of the features we need. password_mgr = ReviewBoardHTTPPasswordMgr(self.url, username, password, auth_callback) self.preset_auth_handler = PresetHTTPAuthHandler(self.url, password_mgr) handlers = [] if disable_proxy: handlers.append(urllib2.ProxyHandler({})) handlers += [ urllib2.HTTPCookieProcessor(self.cookie_jar), ReviewBoardHTTPBasicAuthHandler(password_mgr), urllib2.HTTPDigestAuthHandler(password_mgr), self.preset_auth_handler, ReviewBoardHTTPErrorProcessor(), ] if agent: self.agent = agent else: self.agent = 'RBTools/' + get_package_version() opener = urllib2.build_opener(*handlers) opener.addheaders = [ ('User-agent', self.agent), ] urllib2.install_opener(opener)
def __init__(self, url, cookie_file=None, username=None, password=None, api_token=None, agent=None, session=None, disable_proxy=False, auth_callback=None, otp_token_callback=None): self.url = url if self.url[-1] != '/': self.url += '/' self.url = self.url + 'api/' self.cookie_jar, self.cookie_file = create_cookie_jar( cookie_file=cookie_file) try: self.cookie_jar.load(ignore_expires=True) except IOError: pass if session: parsed_url = urlparse(url) # Get the cookie domain from the url. If the domain # does not contain a '.' (e.g. 'localhost'), we assume # it is a local domain and suffix it (See RFC 2109). domain = parsed_url[1].partition(':')[0] # Remove Port. if domain.count('.') < 1: domain = "%s.local" % domain cookie = cookielib.Cookie(version=0, name=RB_COOKIE_NAME, value=session, port=None, port_specified=False, domain=domain, domain_specified=True, domain_initial_dot=True, path=parsed_url[2], path_specified=True, secure=False, expires=None, discard=False, comment=None, comment_url=None, rest={'HttpOnly': None}) self.cookie_jar.set_cookie(cookie) self.cookie_jar.save() # Set up the HTTP libraries to support all of the features we need. password_mgr = ReviewBoardHTTPPasswordMgr(self.url, username, password, api_token, auth_callback, otp_token_callback) self.preset_auth_handler = PresetHTTPAuthHandler( self.url, password_mgr) handlers = [] if disable_proxy: handlers.append(urllib2.ProxyHandler({})) handlers += [ urllib2.HTTPCookieProcessor(self.cookie_jar), ReviewBoardHTTPBasicAuthHandler(password_mgr), urllib2.HTTPDigestAuthHandler(password_mgr), self.preset_auth_handler, ReviewBoardHTTPErrorProcessor(), ] if agent: self.agent = agent else: self.agent = 'RBTools/' + get_package_version() opener = urllib2.build_opener(*handlers) opener.addheaders = [ ('User-agent', self.agent), ] urllib2.install_opener(opener)
def build_news(): def linkify_bugs(line): return re.sub(r'(Bug #(\d+))', r'<a href="http://www.review-board.org/bug/\2">\1</a>', line) content = "" html_content = "" saw_version = False in_list = False in_item = False fp = open("NEWS", "r") for line in fp.xreadlines(): line = line.rstrip() if line.startswith("version "): if saw_version: # We're done. break saw_version = True elif line.startswith("\t* "): if in_item: html_content += "</li>\n" in_item = False if in_list: html_content += "</ul>\n" html_content += "<p><b>%s</b></p>\n" % line[3:] html_content += "<ul>\n" in_list = True elif line.startswith("\t\t* "): if not in_list: sys.stderr.write("*** Found a list item without a list!\n") continue if in_item: html_content += "</li>\n" html_content += " <li>%s" % linkify_bugs(line[4:]) in_item = True elif line.startswith("\t\t "): if not in_item: sys.stderr.write("*** Found list item content without " "a list item!\n") continue html_content += " " + linkify_bugs(line[4:]) content += line + "\n" fp.close() if in_item: html_content += "</li>\n" if in_list: html_content += "</ul>\n" content = content.rstrip() filename = "dist/%s-%s.NEWS" % (PACKAGE_NAME, get_package_version()) built_files.append(filename) fp = open(filename, "w") fp.write(content) fp.close() filename = "dist/%s-%s.NEWS.html" % (PACKAGE_NAME, get_package_version()) fp = open(filename, "w") fp.write(html_content) fp.close()