2 # Copyright 2012-2020, Damian Johnson and The Tor Project
3 # See LICENSE for licensing information
8 # * Recache latest information (cache_manual.py and cache_fallback_directories.py)
10 # * Test with python3 and pypy.
11 # |- If using tox run...
13 # | % tox -- --all --target RUN_ALL,ONLINE
15 # | Otherwise, for each interpreter run...
17 # | % [python_interpreter] run_tests.py --all --target RUN_ALL,ONLINE
19 # |- Pypy test instructions for ubuntu are...
21 # | % sudo apt-get install pypy
22 # | % wget https://bootstrap.pypa.io/get-pip.py
23 # | % pypy get-pip.py --user
24 # | % ~/.local/bin/pip install mock pycodestyle pyflakes --user
25 # | % pypy ./run_tests.py --all
27 # +- Some version of python 3.x should be available in your platform's
28 # repositories. To test against a specific version on ubuntu try the
29 # following. In this example, Python 3.7...
31 # % sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus
32 # % sudo apt-get install libncursesw5-dev libgdbm-dev libc6-dev
33 # % sudo apt-get install zlib1g-dev libsqlite3-dev tk-dev
34 # % sudo apt-get install libssl-dev openssl libffi-dev
36 # % wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
37 # % tar -xzf Python-3.7.0.tgz
45 # % ~/Python-3.7.0/python ./run_tests.py --all
48 # |- Bump stem's version (in stem/__init__.py and docs/index.rst).
49 # |- git commit -a -m "Stem release 1.0.0"
50 # |- git tag -u 9ABBEEC6 -m "stem release 1.0.0" 1.0.0 d0bb81a
53 # * Dry-run release on https://pypi.org/project/stem/
54 # |- python setup.py sdist --dryrun
55 # |- gpg --detach-sig --armor dist/stem-dry-run-1.0.0.tar.gz
56 # |- twine upload dist/*
57 # +- Check that https://pypi.org/project/stem-dry-run/ looks correct, comparing it to https://pypi.org/project/stem/
58 # +- Don't worry about the 'Bug Tracker' being missing. That's an attribute of the project itself.
62 # |- python setup.py sdist
63 # |- gpg --detach-sig --armor dist/stem-1.0.0.tar.gz
64 # +- twine upload dist/*
66 # * Contact package maintainers
67 # * Announce the release (example: https://blog.torproject.org/blog/stem-release-11)
74 if '--dryrun' in sys
.argv
:
76 sys
.argv
.remove('--dryrun')
80 SUMMARY
= 'Stem is a Python controller library that allows applications to interact with Tor (https://www.torproject.org/).'
81 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).'
84 For tutorials and API documentation see `Stem's homepage <https://stem.torproject.org/>`_.
89 To install you can either use...
95 ... or install from the source tarball. Stem supports Python 3.6 and above.
97 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>`_.
101 include cache_fallback_directories.py
102 include cache_manual.py
106 include requirements.txt
111 global-exclude __pycache__
112 global-exclude *.orig
118 recursive-exclude test/data *
119 recursive-exclude docs/_build *
122 # installation requires us to be in our setup.py's directory
124 os
.chdir(os
.path
.dirname(os
.path
.abspath(__file__
)))
126 with
open('MANIFEST.in', 'w') as manifest_file
:
127 manifest_file
.write(MANIFEST
)
130 def get_module_info():
131 # reads the basic __stat__ strings from our module's init
133 STAT_REGEX
= re
.compile(r
"^__(.+)__ = '(.+)'$")
135 cwd
= os
.path
.sep
.join(__file__
.split(os
.path
.sep
)[:-1])
137 with
open(os
.path
.join(cwd
, 'stem', '__init__.py')) as init_file
:
138 for line
in init_file
.readlines():
139 line_match
= STAT_REGEX
.match(line
)
142 keyword
, value
= line_match
.groups()
143 result
[keyword
] = value
148 module_info
= get_module_info()
152 name
= 'stem-dry-run' if DRY_RUN
else 'stem',
153 version
= module_info
['version'],
154 description
= DRY_RUN_SUMMARY
if DRY_RUN
else SUMMARY
,
155 long_description
= DESCRIPTION
,
156 license
= module_info
['license'],
157 author
= module_info
['author'],
158 author_email
= module_info
['contact'],
159 url
= module_info
['url'],
160 packages
= setuptools
.find_packages(exclude
=['test*']),
161 keywords
= 'tor onion controller',
162 scripts
= ['tor-prompt'],
164 'stem': ['cached_fallbacks.cfg', 'cached_manual.sqlite', 'settings.cfg'],
165 'stem.interpreter': ['settings.cfg'],
166 'stem.util': ['ports.cfg'],
168 'Development Status :: 5 - Production/Stable',
169 'Intended Audience :: Developers',
170 'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)',
172 'Topic :: Software Development :: Libraries :: Python Modules',
176 for filename
in ['MANIFEST.in', 'MANIFEST']:
177 if os
.path
.exists(filename
):