Skip to content

Commit

Permalink
Merge pull request #53 from HexDecimal/windows-support
Browse files Browse the repository at this point in the history
Add Windows support
  • Loading branch information
z4r committed Oct 10, 2016
2 parents abe83a8 + aa74c5a commit d2283b9
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 14 deletions.
33 changes: 33 additions & 0 deletions appveyor.yml
@@ -0,0 +1,33 @@
environment:
matrix:
- PYTHON: C:\Python27\python.exe
platform: Any CPU
- PYTHON: C:\Python33\python.exe
platform: Any CPU
- PYTHON: C:\Python34\python.exe
platform: Any CPU
- PYTHON: C:\Python35\python.exe
platform: Any CPU

before_build:
- "%PYTHON% -m pip install virtualenv"
- "%PYTHON% -m virtualenv venv"
- venv\Scripts\activate.bat

build_script:
- pip install -U pip
- python setup.py develop

before_test:
- pip install -r test_requirements.txt
- 'git clone https://github.com/z4r/python-coveralls-example.git'
- cd python-coveralls-example
- git checkout -qf 3e82fd5159b84bebe9bc6c9fd3959f322e6f7098
- py.test example/tests.py --cov=example
- cd %APPVEYOR_BUILD_FOLDER%

test_script:
- py.test coveralls/tests.py --doctest-modules --pep8 coveralls -v --cov coveralls --cov-report term-missing

#on_success:
# - coveralls
5 changes: 4 additions & 1 deletion coveralls/report.py
@@ -1,3 +1,6 @@

import os

import json

from coverage.report import Reporter
Expand Down Expand Up @@ -28,7 +31,7 @@ def report(self, base_dir, ignore_errors=False, merge_file=None):
if lineno + 1 in analysis.statements:
coverage_list[lineno] = int(lineno + 1 not in analysis.missing)
ret.append({
'name': fr.filename.replace(base_dir, '').lstrip('/'),
'name': fr.filename.replace(base_dir, '').lstrip(os.sep).replace(os.sep, '/'),
'source': ''.join(source).rstrip(),
'coverage': coverage_list,
})
Expand Down
22 changes: 15 additions & 7 deletions coveralls/repository.py
@@ -1,15 +1,23 @@

import sys
import os
import sh

try:
from subprocess32 import check_output
except ImportError:
from subprocess import check_output

FORMAT = '%n'.join(['%H', '%aN', '%ae', '%cN', '%ce', '%s'])


def gitrepo(root):
tmpdir = sh.pwd().strip()
sh.cd(root)
gitlog = sh.git('--no-pager', 'log', '-1', pretty="format:%s" % FORMAT).split('\n', 5)
branch = os.environ.get('CIRCLE_BRANCH') or os.environ.get('TRAVIS_BRANCH', sh.git('rev-parse', '--abbrev-ref', 'HEAD').strip())
remotes = [x.split() for x in filter(lambda x: x.endswith('(fetch)'), sh.git.remote('-v').strip().splitlines())]
sh.cd(tmpdir)
tmpdir = os.getcwd()
os.chdir(root)
gitlog = check_output(['git', '--no-pager', 'log', '-1', '--pretty=format:%s' % FORMAT], universal_newlines=True).split('\n', 5)
branch = (os.environ.get('CIRCLE_BRANCH') or
os.environ.get('TRAVIS_BRANCH', check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip()))
remotes = [x.split() for x in filter(lambda x: x.endswith('(fetch)'), check_output(['git', 'remote', '-v']).decode().strip().splitlines())]
os.chdir(tmpdir)
return {
"head": {
"id": gitlog[0],
Expand Down
5 changes: 0 additions & 5 deletions requirements.txt

This file was deleted.

9 changes: 8 additions & 1 deletion setup.py
Expand Up @@ -19,9 +19,16 @@
description = readme[1]
long_description = ''.join(readme)

reqs = open(os.path.join(os.path.dirname(__file__), 'requirements.txt')).readlines()
reqs = [
'PyYAML',
'requests',
'coverage==4.0.3',
'six',
]

if sys.version_info < (2, 7):
reqs.append('argparse')
reqs.append('subprocess32')

setup(
name=name,
Expand Down

0 comments on commit d2283b9

Please sign in to comment.