This commit is contained in:
Rok Garbas 2016-05-13 04:02:48 +02:00
Родитель 6a4735b5fb
Коммит 7d73f25ad4
6 изменённых файлов: 166 добавлений и 14 удалений

7
.gitignore поставляемый
Просмотреть файл

@ -3,14 +3,17 @@
*.swp
/TODO.txt
/dist
/dist/
/docs/build/
/env/
/requirements-flatten.txt
/src/relengapi/.coverage
/src/relengapi/.coverage-html
/src/relengapi/docs_build_dir/
/src/relengapi/relengapi.egg-info/
/src/relengapi/result
/src/relengapi_clobberer/relengapi_clobberer.egg-info/
/src/relengapi_clobberer/env/
/src/relengapi_clobberer/relengapi_clobberer.egg-info/
/src/relengapi_common/relengapi_common.egg-info/
/src/relengapi_tools/.coverage
/src/relengapi_tools/build

Просмотреть файл

@ -2,19 +2,14 @@ language: python
sudo: false
python:
- "2.7"
env:
# the 'relengapi' command wants a settings file, but the contents
# aren't terribly important, so the example will do fine
- RELENGAPI_SETTINGS=$PWD/settings_example.py
# command to install dependencies
- DATABASE_URL=sqlite:///$PWD/app.db
- NODE_VERSION=6
install:
- pip install -r requirements.txt -r requirements-ldap.txt -r requirements-test.txt -e src/relengapi
# run everything in a single script, so we get a nice summary at the end
script:
- bash ./validate.sh
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $NODE_VERSION
- make install
- git clone https://github.com/taskcluster/neo
- sed -i -e 's|file:../../../neo|file:../../neo|' src/relengapi_tools/package.json
script: "make lint check docs"
after_success:
- codecov

60
Makefile Normal file
Просмотреть файл

@ -0,0 +1,60 @@
NPM=npm
VIRTUALENV=virtualenv
PYTHON=./env/bin/python
PIP=./env/bin/pip
FLAKE8=./env/bin/flake8
PYTEST=./env/bin/py.test
ENV=./env
.PHONY: help
help:
@echo "Commands:"
@echo ""
@echo " install TODO..."
@echo " check TODO..."
@echo " docs TODO..."
@echo " lint TODO..."
@echo " clean TODO..."
.PHONY: install
install: env
rm -f requirements-flatten.txt
$(PYTHON) flatten_requirements.py requirements-dev.txt requirements-flatten.txt
$(PIP) install -r requirements-flatten.txt
cd src/relengapi_tools && $(NPM) install
.PHONY: lint
lint:
$(FLAKE8) \
run.py \
flatten_requirements.py \
src/relengapi_clobberer/setup.py \
src/relengapi_clobberer/relengapi_clobberer
cd src/relengapi_tools && $(NPM) run build
.PHONY: docs
docs:
cd docs/ && $(MAKE) html
.PHONY: check
check:
$(PYTEST) \
src/relengapi_clobberer/tests/
cd src/relengapi_tools && $(NPM) run test
.PHONY: env
env:
$(VIRTUALENV) $(ENV)
.PHONY: clean
clean:
rm -rf $(ENV)
rm -rf src/relengapi_tools/node_modules/
.PHONY: clean
requirements-dev.txt: clean env
rm -f requirements-dev.txt
$(PIP) install Sphinx pytest flake8
$(PIP) freeze | grep -v relengapi- > requirements-dev.txt

26
README.rst Normal file
Просмотреть файл

@ -0,0 +1,26 @@
Welcome to relengapi
====================
Purspose of relengapi ... TODO
- Documentation: https://docs.relengapi.mozilla.org
- Issues: https://gitub.com/mozilla/build-relengapi/issues
- Code: https://gitub.com/mozilla/build-relengapi
Repository structure
====================
- contribute.json
- CONTRIBUTING.rst
- LICENSE.txt
- Makefile
- README.rst
- src/
- relengapi/
Read its README for more info.
- relengapi_tools/
Read its README for more info.
- relengapi_clobberer/
Read its README for more info.
TODO

48
flatten_requirements.py Normal file
Просмотреть файл

@ -0,0 +1,48 @@
import os
import sys
class Error(Exception):
code = 1
def parse_file(requirements_file):
with open(requirements_file) as f:
for line in f.readlines():
line = line.strip()
if line.startswith('-r '):
for line2 in parse_file(line[3:]):
yield line2
else:
yield line
def main(requirements_file, flatten_file):
if not os.path.isfile(requirements_file):
raise Error("Requirements file (`%s`) you wish to flatten does not "
"exists" % requirements_file)
if os.path.isfile(flatten_file):
raise Error("File (`%s`) you wish to write flatten requirements to "
"already exists" % flatten_file)
lines = set(parse_file(requirements_file))
with open(flatten_file, 'w+') as f:
f.write('\n'.join(lines))
if __name__ == "__main__":
if len(sys.argv) != 3:
print "help: TODO"
sys.exit(1)
try:
code = 0
main(sys.argv[1], sys.argv[2])
except Error, e:
print e.message
code = e.code
sys.exit(code)

20
requirements-dev.txt Normal file
Просмотреть файл

@ -0,0 +1,20 @@
alabaster==0.7.8
Babel==2.3.4
docutils==0.12
flake8==2.5.4
imagesize==0.7.1
Jinja2==2.8
MarkupSafe==0.23
mccabe==0.4.0
pep8==1.7.0
py==1.4.31
pyflakes==1.0.0
Pygments==2.1.3
pytest==2.9.1
pytz==2016.4
six==1.10.0
snowballstemmer==1.2.1
Sphinx==1.4.1
virtualenv==13.1.2
wheel==0.24.0
-r requirements.txt