Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPT: Use regex to get NSIS binaries on Windows #102

Open
wants to merge 5 commits into
base: AddAppveyor
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
21 changes: 21 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
platform:
- x86
- x64
configuration:
- Debug
- Release

skip_tags: true
os:
- Visual Studio 2015

build:
parallel: true
verbosity: normal

install:
- C:\"Program Files (x86)"\"Microsoft Visual Studio 14.0"\VC\vcvarsall.bat
- "SET PATH=C:\\Python35;C:\\Python35\\Scripts;%PATH%"

build_script:
- tools\packaging\cpt.py --current-dev=tar --with-cling-url=https://github.com/vgvassilev/cling
23 changes: 18 additions & 5 deletions tools/packaging/cpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
if sys.version_info < (3, 0):
# Python 2.x
from urllib2 import urlopen
from HTMLParser import HTMLParser

input = raw_input
else:
# Python 3.x
from urllib.request import urlopen
from html.parser import HTMLParser

import argparse
import os
Expand Down Expand Up @@ -1019,14 +1021,25 @@ def check_win(pkg):
print(pkg.ljust(20) + '[OK]'.ljust(30))


class NSISVersionParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.out = None
def handle_data(self, data):
r = re.match(r'^v(?:\d+)(?!(a|b|rc)(?:\d+)?)$', data)
if r:
self.out = r.group()


def get_win_dep():
box_draw("Download NSIS compiler")
html = urlopen('http://sourceforge.net/p/nsis/code/HEAD/tree/NSIS/tags/').read().decode('utf-8')
NSIS_VERSION = html[html.rfind('<a href="v'):html.find('>', html.rfind('<a href="v'))].strip('<a href="v').strip(
'"')
NSIS_VERSION = NSIS_VERSION[:1] + '.' + NSIS_VERSION[1:]
html = urlopen('https://sourceforge.net/p/nsis/code/HEAD/tree/NSIS/tags/').read().decode('utf-8')
nsis_parser = NSISVersionParser()
nsis_parser.feed(html)
NSIS_VERSION = nsis_parser.out
NSIS_VERSION = NSIS_VERSION[1:2] + '.' + NSIS_VERSION[2:3]
print('Latest version of NSIS is: ' + NSIS_VERSION)
wget(url="http://sourceforge.net/projects/nsis/files/NSIS%%203%%20Pre-release/%s/nsis-%s.zip" % (
wget(url="https://sourceforge.net/projects/nsis/files/NSIS%%203/%s/nsis-%s.zip" % (
NSIS_VERSION, NSIS_VERSION),
out_dir=TMP_PREFIX)
print('Extracting: ' + os.path.join(TMP_PREFIX, 'nsis-%s.zip' % (NSIS_VERSION)))
Expand Down