Skip to content

Commit 5c85a9f

Browse files
authored
Merge pull request #9 from cs50/travis/pypi
tweaks for CI and CD
2 parents 46aeb6b + 308d3a9 commit 5c85a9f

File tree

9 files changed

+84
-46
lines changed

9 files changed

+84
-46
lines changed

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.*
22
!.gitignore
3-
*.pyc
4-
__pycache__/
5-
build/
3+
!.travis.yml
4+
dist/
5+
*.egg-info/

.travis.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
language: python
2+
3+
python: "3.4"
4+
5+
# build sdist
6+
script: make build
7+
8+
# install twine for uploading to PyPI
9+
before_deploy: pip install twine
10+
11+
deploy:
12+
13+
# create github release
14+
- provider: releases
15+
16+
# GitHub access token
17+
api_key:
18+
secure: "Hv2ICkPkC7hiRw8GS9adkEcfoYGeVPbGHRNPQdGxLTeP1Mz9x/2ylUprrb2Ohq+pHGRa1W55nSJAZWHto4L/seWS17vN1JB1o71KYeD8h4Ywm/iJzYJFu4v8cmuT9qMPC89GtSGUkEZml+Vd6lb6d/eBr7HWoAMF7LCobzVvpJftgSBqkN1Z0aaunGNRtPVaqf0D4iQMSU1e0X9HFyIsxjS68sNqVcU/eSqbkHQ32COliOdEZXDqNmoJjIq4NYVH7DCS4kSpfxSd3BkJPn1UH4891MntflMllH7khmSA0lqSuunp+olfzhzchYb0/e0LavqYyFU/cRemyt8RBuE0GD3J3TMudVav/5HLKt6/exZwqfv7bHyorDXkkKGJqYNPUCOD2K4RS4ExpUU5c5en5inJZdgKYVI9gZS15oXmKV3H/8JkJPgx0xRP1Rx8niQKezKdFb0dZxArbMBUuAnolgyoq2EgnsNYhboRWXoJP36FCWFn8U8UNUfmgOkkMcP59mZ6svznxWPIyCMhfGgShY03GTvPp94P6c6OZJpjyjmWyPsvGZJrvnRlJ8VxBaUBcfuQl9rtBorwJ3VI1VWguyBaSINM6OWPtEJ0J2oVM/8Dvjuw2qPNkCdUhflc7wV/AUYB9/6rfpjY+GwTEKtZBBw4epbZX/B0L+vdRONZJ0Q="
19+
20+
# enable wildcards in filenames
21+
file_glob: true
22+
23+
# upload sdist
24+
file: dist/*
25+
26+
# avoid stashing sdist
27+
skip_cleanup: true
28+
29+
# create releases on tags only
30+
on:
31+
tags: true
32+
33+
# deploy to PyPI
34+
- provider: script
35+
36+
# upload sdist to PyPI
37+
script: twine upload -u $PYPI_USERNAME -p $PYPI_PASSWORD dist/*
38+
39+
# avoid stashing sdist
40+
skip_cleanup: true
41+
42+
# deploy on tags only
43+
on:
44+
tags: true

Makefile

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,22 @@
1-
BUILD_DIR = build
2-
DESCRIPTION = CS50 Library for Python
3-
MAINTAINER = CS50 <sysadmins@cs50.harvard.edu>
4-
NAME = python-cs50
5-
OLD_NAME = lib50-python
6-
VERSION = 1.3.0
7-
8-
.PHONY: bash
9-
bash:
10-
docker run -i --rm -t -v "$(PWD)":/root cs50/cli
11-
121
.PHONY: build
132
build: clean
14-
mkdir -p "$(BUILD_DIR)"/usr/lib/python2.7/dist-packages/cs50
15-
cp src/* "$(BUILD_DIR)"/usr/lib/python2.7/dist-packages/cs50
16-
mkdir -p "$(BUILD_DIR)"/usr/lib/python3/dist-packages/cs50
17-
cp src/* "$(BUILD_DIR)"/usr/lib/python3/dist-packages/cs50
3+
python setup.py sdist
184

195
.PHONY: clean
206
clean:
21-
rm -rf "$(BUILD_DIR)"
7+
rm -rf *.egg-info dist
8+
9+
.PHONY: install
10+
install: build
11+
pip install dist/*.tar.gz
12+
13+
.PHONY: push
14+
push:
15+
git push origin "v$$(python setup.py --version)"
16+
17+
.PHONY: release
18+
release: tag push
2219

23-
.PHONY: deb
24-
deb: build
25-
fpm \
26-
-C "$(BUILD_DIR)" \
27-
-m "$(MAINTAINER)" \
28-
-n "$(NAME)" \
29-
-p "$(BUILD_DIR)" \
30-
-s dir \
31-
-t deb \
32-
-v "$(VERSION)" \
33-
--after-install after-install.sh \
34-
--conflicts "$(NAME) (<< $(VERSION)), $(OLD_NAME)" \
35-
--deb-no-default-config-files \
36-
--depends python \
37-
--depends python3 \
38-
--description "$(DESCRIPTION)" \
39-
--replaces "$(NAME) (<= $(VERSION)), $(OLD_NAME)" \
40-
--provides "$(NAME)" \
41-
--provides "$(OLD_NAME)" \
42-
usr
20+
.PHONY: tag
21+
tag:
22+
git tag "v$$(python setup.py --version)"

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# CS50 Library for Python
22

3+
[![Build Status](https://travis-ci.org/cs50/python-cs50.svg?branch=master)](https://travis-ci.org/cs50/python-cs50)
4+
35
Supports Python 2 and Python 3.
46

57
## Development

after-install.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

src/sql.py renamed to cs50/sql.py

File renamed without changes.

setup.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from setuptools import setup
2+
3+
setup(
4+
author="CS50",
5+
author_email="sysadmins@cs50.harvard.edu",
6+
classifiers=[
7+
"Intended Audience :: Developers",
8+
"Programming Language :: Python",
9+
"Programming Language :: Python :: 3",
10+
"Topic :: Software Development :: Libraries :: Python Modules"
11+
],
12+
description="CS50 library for Python",
13+
install_requires=["SQLAlchemy"],
14+
keywords="cs50",
15+
name="cs50",
16+
packages=["cs50"],
17+
url="https://github.com/cs50/python-cs50",
18+
version="1.3.0"
19+
)

0 commit comments

Comments
 (0)