2012-11-25 20:11:59 +00:00
#!/usr/bin/env python
2020-01-02 19:35:10 +00:00
# Copyright 2012-2020, Damian Johnson and The Tor Project
2013-02-17 21:22:54 +00:00
# See LICENSE for licensing information
2017-07-03 18:24:47 +00:00
#
# Release Checklist
# =================
#
# * Recache latest information (cache_manual.py and cache_fallback_directories.py)
#
2020-01-05 21:08:03 +00:00
# * Test with python3 and pypy.
2018-10-04 17:56:26 +00:00
# |- If using tox run...
# |
# | % tox -- --all --target RUN_ALL,ONLINE
# |
# | Otherwise, for each interpreter run...
# |
# | % [python_interpreter] run_tests.py --all --target RUN_ALL,ONLINE
# |
# |- Pypy test instructions for ubuntu are...
# |
# | % sudo apt-get install pypy
# | % wget https://bootstrap.pypa.io/get-pip.py
# | % pypy get-pip.py --user
# | % ~/.local/bin/pip install mock pycodestyle pyflakes --user
# | % pypy ./run_tests.py --all
# |
# +- Some version of python 3.x should be available in your platform's
# repositories. To test against a specific version on ubuntu try the
# following. In this example, Python 3.7...
#
# % sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus
# % sudo apt-get install libncursesw5-dev libgdbm-dev libc6-dev
# % sudo apt-get install zlib1g-dev libsqlite3-dev tk-dev
# % sudo apt-get install libssl-dev openssl libffi-dev
#
# % wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
# % tar -xzf Python-3.7.0.tgz
# % mv Python-3.7.0 ~
#
# % cd ~/Python-3.7.0
# % ./configure
# % make
#
# % cd /path/to/stem
# % ~/Python-3.7.0/python ./run_tests.py --all
2018-05-26 20:47:10 +00:00
#
2017-07-03 18:24:47 +00:00
# * Tag the release
# |- Bump stem's version (in stem/__init__.py and docs/index.rst).
2017-07-03 22:03:56 +00:00
# |- git commit -a -m "Stem release 1.0.0"
2017-07-03 18:24:47 +00:00
# |- git tag -u 9ABBEEC6 -m "stem release 1.0.0" 1.0.0 d0bb81a
# +- git push --tags
#
2019-04-11 19:18:31 +00:00
# * Dry-run release on https://pypi.org/project/stem/
2017-08-28 16:38:07 +00:00
# |- python setup.py sdist --dryrun
2017-07-03 18:24:47 +00:00
# |- gpg --detach-sig --armor dist/stem-dry-run-1.0.0.tar.gz
# |- twine upload dist/*
2019-04-11 19:18:31 +00:00
# +- Check that https://pypi.org/project/stem-dry-run/ looks correct, comparing it to https://pypi.org/project/stem/
2017-11-06 23:30:01 +00:00
# +- Don't worry about the 'Bug Tracker' being missing. That's an attribute of the project itself.
2017-07-03 18:24:47 +00:00
#
# * Final release
# |- rm dist/*
# |- python setup.py sdist
# |- gpg --detach-sig --armor dist/stem-1.0.0.tar.gz
# +- twine upload dist/*
#
# * Contact package maintainers
# * Announce the release (example: https://blog.torproject.org/blog/stem-release-11)
2012-11-25 20:11:59 +00:00
2020-03-30 20:53:57 +00:00
import setuptools
2016-12-05 22:04:52 +00:00
import os
2020-04-02 12:34:59 +00:00
import re
2017-08-28 16:38:07 +00:00
import sys
2012-11-25 20:11:59 +00:00
2017-08-28 16:38:07 +00:00
if ' --dryrun ' in sys . argv :
DRY_RUN = True
sys . argv . remove ( ' --dryrun ' )
else :
DRY_RUN = False
2016-11-17 18:06:01 +00:00
SUMMARY = ' Stem is a Python controller library that allows applications to interact with Tor (https://www.torproject.org/). '
2016-12-05 22:04:52 +00:00
DRY_RUN_SUMMARY = ' Ignore this package. This is dry-run release creation to work around PyPI limitations (https://github.com/pypa/packaging-problems/issues/74#issuecomment-260716129). '
2016-11-17 18:06:01 +00:00
DESCRIPTION = """
2016-12-08 18:41:07 +00:00
For tutorials and API documentation see ` Stem ' s homepage <https://stem.torproject.org/>`_.
2016-11-17 18:06:01 +00:00
Quick Start
- - - - - - - - - - -
To install you can either use . . .
: :
pip install stem
2016-12-05 22:04:52 +00:00
2020-01-05 21:08:03 +00:00
. . . or install from the source tarball . Stem supports Python 3.6 and above .
2016-11-17 18:06:01 +00:00
After that , give some ` tutorials < https : / / stem . torproject . org / tutorials . html > ` _ a try ! For questions or to discuss project ideas we ' re available on `irc <https://www.torproject.org/about/contact.html.en#irc>`_ and the `tor-dev@ email list <https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev>`_.
""" .strip()
2012-11-25 20:11:59 +00:00
2016-12-05 22:10:52 +00:00
MANIFEST = """
include cache_fallback_directories . py
include cache_manual . py
include LICENSE
2018-08-06 01:42:19 +00:00
include README . md
2016-12-05 22:10:52 +00:00
include MANIFEST . in
include requirements . txt
include run_tests . py
include tox . ini
graft docs
graft test
global - exclude __pycache__
global - exclude * . orig
global - exclude * . pyc
global - exclude * . swp
global - exclude * . swo
global - exclude . tox
2017-01-30 18:44:13 +00:00
global - exclude * ~
2016-12-05 22:10:52 +00:00
recursive - exclude test / data *
recursive - exclude docs / _build *
""" .strip()
2016-12-08 18:41:07 +00:00
# installation requires us to be in our setup.py's directory
2016-12-05 22:04:52 +00:00
os . chdir ( os . path . dirname ( os . path . abspath ( __file__ ) ) )
2016-12-05 22:10:52 +00:00
with open ( ' MANIFEST.in ' , ' w ' ) as manifest_file :
manifest_file . write ( MANIFEST )
2020-03-30 20:53:57 +00:00
2020-04-02 12:34:59 +00:00
def get_module_info ( ) :
# reads the basic __stat__ strings from our module's init
STAT_REGEX = re . compile ( r " ^__(.+)__ = ' (.+) ' $ " )
result = { }
cwd = os . path . sep . join ( __file__ . split ( os . path . sep ) [ : - 1 ] )
with open ( os . path . join ( cwd , ' stem ' , ' __init__.py ' ) ) as init_file :
for line in init_file . readlines ( ) :
line_match = STAT_REGEX . match ( line )
if line_match :
keyword , value = line_match . groups ( )
result [ keyword ] = value
return result
module_info = get_module_info ( )
2016-12-05 22:10:52 +00:00
try :
2020-03-30 20:53:57 +00:00
setuptools . setup (
2016-12-05 22:10:52 +00:00
name = ' stem-dry-run ' if DRY_RUN else ' stem ' ,
2020-04-02 12:34:59 +00:00
version = module_info [ ' version ' ] ,
2016-12-05 22:10:52 +00:00
description = DRY_RUN_SUMMARY if DRY_RUN else SUMMARY ,
long_description = DESCRIPTION ,
2020-04-02 12:34:59 +00:00
license = module_info [ ' license ' ] ,
author = module_info [ ' author ' ] ,
author_email = module_info [ ' contact ' ] ,
url = module_info [ ' url ' ] ,
2020-03-31 01:56:57 +00:00
packages = setuptools . find_packages ( exclude = [ ' test* ' ] ) ,
2016-12-05 22:10:52 +00:00
keywords = ' tor onion controller ' ,
scripts = [ ' tor-prompt ' ] ,
2016-12-06 19:00:03 +00:00
package_data = {
2018-05-05 20:11:25 +00:00
' stem ' : [ ' cached_fallbacks.cfg ' , ' cached_manual.sqlite ' , ' settings.cfg ' ] ,
2016-12-06 19:00:03 +00:00
' stem.interpreter ' : [ ' settings.cfg ' ] ,
' stem.util ' : [ ' ports.cfg ' ] ,
} , classifiers = [
2016-12-05 22:10:52 +00:00
' Development Status :: 5 - Production/Stable ' ,
' Intended Audience :: Developers ' ,
' License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3) ' ,
' Topic :: Security ' ,
' Topic :: Software Development :: Libraries :: Python Modules ' ,
] ,
)
finally :
2020-03-30 20:54:47 +00:00
for filename in [ ' MANIFEST.in ' , ' MANIFEST ' ] :
if os . path . exists ( filename ) :
os . remove ( filename )