Compare commits
14 Commits
master
...
switch-to-
Author | SHA1 | Date |
---|---|---|
Jean-Paul Calderone | d71314dfd8 | |
Jean-Paul Calderone | 81f6eb5d14 | |
Jean-Paul Calderone | d068e421c7 | |
Jean-Paul Calderone | a47ec5acef | |
Jean-Paul Calderone | 46c996c662 | |
Jean-Paul Calderone | 4ed1b27aba | |
Jean-Paul Calderone | 25901f03c1 | |
Jean-Paul Calderone | 94ae3eaf5c | |
Jean-Paul Calderone | 63b7e559f1 | |
Jean-Paul Calderone | 3a26c6a36b | |
Jean-Paul Calderone | 5253c47c5e | |
Jean-Paul Calderone | 6f9d239b53 | |
Jean-Paul Calderone | 9ac8db4151 | |
Jean-Paul Calderone | 0d570f76be |
60
default.nix
60
default.nix
|
@ -51,11 +51,52 @@ in
|
|||
# `setup.py update_version` has been run (this is not at all ideal but it
|
||||
# seems difficult to fix) - so for now just be sure to run that first.
|
||||
mach-nix.buildPythonPackage rec {
|
||||
# Define the location of the Tahoe-LAFS source to be packaged. Clean up all
|
||||
# as many of the non-source files (eg the `.git` directory, `~` backup
|
||||
# files, nix's own `result` symlink, etc) as possible to avoid needing to
|
||||
# re-build when files that make no difference to the package have changed.
|
||||
src = pkgs.lib.cleanSource ./.;
|
||||
# Define the location of the Tahoe-LAFS source to be packaged. We can't
|
||||
src = pkgs.lib.cleanSourceWith {
|
||||
# Define our own filter because we need to keep the whole `.git` directory
|
||||
# for setuptools-scm. :/
|
||||
filter = name: type:
|
||||
let baseName = baseNameOf (toString name);
|
||||
in ! (
|
||||
baseName == "__pycache__" ||
|
||||
baseName == ".hypothesis" ||
|
||||
baseName == ".tox" ||
|
||||
baseName == ".mypy_cache" ||
|
||||
pkgs.lib.hasPrefix "_trial_temp" baseName ||
|
||||
pkgs.lib.hasSuffix ".pyc" baseName ||
|
||||
pkgs.lib.hasSuffix ".pyo" baseName ||
|
||||
pkgs.lib.hasSuffix "~" baseName ||
|
||||
type == "symlink" ||
|
||||
type == "unknown"
|
||||
);
|
||||
src = ./.;
|
||||
};
|
||||
|
||||
# The name and most other metadata can be discovered from the package
|
||||
# metadata files. However, setuptools-scm is too tricky for mach-nix so we
|
||||
# have to duplicate the version information here.
|
||||
version = "1.18.1.post1";
|
||||
|
||||
pythonImportsCheck = [ "allmydata" ];
|
||||
|
||||
# This is really a check but I can't get checks to run. I think mach-nix
|
||||
# works hard to disable them.
|
||||
#
|
||||
# Check that the nix and Python package metadata are roughly in agreement
|
||||
# regarding the version information.
|
||||
postInstall = ''
|
||||
python -c "
|
||||
from allmydata import __version__ as v
|
||||
w = '${version}'
|
||||
print(v)
|
||||
print(w)
|
||||
raise SystemExit(v.split('.')[:3] != w.split('.')[:3])
|
||||
"
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkgs.git
|
||||
];
|
||||
|
||||
# Select whichever package extras were requested.
|
||||
inherit extras;
|
||||
|
@ -72,14 +113,7 @@ mach-nix.buildPythonPackage rec {
|
|||
# build-time requirements of our dependencies which are declared in such a
|
||||
# file. Tell it about them here.
|
||||
setuptools_rust
|
||||
|
||||
# mach-nix does not yet parse environment markers (e.g. "python > '3.0'")
|
||||
# correctly. It misses all of our requirements which have an environment marker.
|
||||
# Duplicate them here.
|
||||
foolscap
|
||||
eliot
|
||||
pyrsistent
|
||||
collections-extended
|
||||
setuptools_scm
|
||||
'';
|
||||
|
||||
# Specify where mach-nix should find packages for our Python dependencies.
|
||||
|
|
|
@ -83,7 +83,7 @@ Create Branch and Apply Updates
|
|||
- summarize major changes
|
||||
- commit it
|
||||
|
||||
- update "nix/tahoe-lafs.nix"
|
||||
- update "default.nix"
|
||||
|
||||
- change the value given for `version` from `OLD.post1` to `NEW.post1`
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
[build-system]
|
||||
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
|
||||
|
||||
[tool.setuptools_scm]
|
||||
write_to = "src/allmydata/_version.py"
|
223
setup.cfg
223
setup.cfg
|
@ -1,10 +1,219 @@
|
|||
[aliases]
|
||||
build = update_version build
|
||||
sdist = update_version sdist
|
||||
install = update_version install
|
||||
develop = update_version develop
|
||||
bdist_egg = update_version bdist_egg
|
||||
bdist_wheel = update_version bdist_wheel
|
||||
# https://setuptools.pypa.io/en/latest/userguide/declarative_config.html#declarative-config
|
||||
[metadata]
|
||||
name = tahoe-lafs
|
||||
|
||||
[options]
|
||||
description = secure, decentralized, fault-tolerant file store
|
||||
long_description = file: README.rst
|
||||
author = the Tahoe-LAFS project
|
||||
author_email = tahoe-dev@lists.tahoe-lafs.org
|
||||
project_urls =
|
||||
website=https://tahoe-lafs.org/
|
||||
documentation=https://tahoe-lafs.readthedocs.org/
|
||||
source=https://github.com/tahoe-lafs/tahoe-lafs
|
||||
classifiers = file: CLASSIFIERS.txt
|
||||
license_files = COPYING.GPL, COPYING.TGPPL.rst
|
||||
# tell setuptools to find our package source files automatically
|
||||
packages = find:
|
||||
# find packages beneath the src directory
|
||||
package_dir=
|
||||
=src
|
||||
include_package_data = True
|
||||
|
||||
# We support Python 3.7 or later. 3.11 is not supported yet.
|
||||
python_requires = >=3.7, <3.11
|
||||
|
||||
install_requires =
|
||||
# we don't need much out of setuptools but the version checking stuff
|
||||
# needs pkg_resources and PEP 440 version specifiers.
|
||||
setuptools >= 28.8.0
|
||||
|
||||
zfec >= 1.1.0
|
||||
|
||||
# zope.interface >= 3.6.0 is required for Twisted >= 12.1.0.
|
||||
zope.interface >= 3.6.0
|
||||
|
||||
# * foolscap < 0.5.1 had a performance bug which spent O(N**2) CPU for
|
||||
# transferring large mutable files of size N.
|
||||
# * foolscap < 0.6 is incompatible with Twisted 10.2.0.
|
||||
# * foolscap 0.6.1 quiets a DeprecationWarning.
|
||||
# * foolscap < 0.6.3 is incompatible with Twisted 11.1.0 and newer.
|
||||
# * foolscap 0.8.0 generates 2048-bit RSA-with-SHA-256 signatures,
|
||||
# rather than 1024-bit RSA-with-MD5. This also allows us to work
|
||||
# with a FIPS build of OpenSSL.
|
||||
# * foolscap >= 0.12.3 provides tcp/tor/i2p connection handlers we need,
|
||||
# and allocate_tcp_port
|
||||
# * foolscap >= 0.12.5 has ConnectionInfo and ReconnectionInfo
|
||||
# * foolscap >= 0.12.6 has an i2p.sam_endpoint() that takes kwargs
|
||||
# * foolscap 0.13.2 drops i2p support completely
|
||||
# * foolscap >= 21.7 is necessary for Python 3 with i2p support.
|
||||
foolscap >= 21.7.0
|
||||
|
||||
# * cryptography 2.6 introduced some ed25519 APIs we rely on. Note that
|
||||
# Twisted[conch] also depends on cryptography and Twisted[tls]
|
||||
# transitively depends on cryptography. So it's anyone's guess what
|
||||
# version of cryptography will *really* be installed.
|
||||
cryptography >= 2.6
|
||||
|
||||
# * The SFTP frontend depends on Twisted 11.0.0 to fix the SSH server
|
||||
# rekeying bug <https://twistedmatrix.com/trac/ticket/4395>
|
||||
# * The SFTP frontend and manhole depend on the conch extra. However, we
|
||||
# can't explicitly declare that without an undesirable dependency on gmpy,
|
||||
# as explained in ticket #2740.
|
||||
# * Due to a setuptools bug, we need to declare a dependency on the tls
|
||||
# extra even though we only depend on it via foolscap.
|
||||
# * Twisted >= 15.1.0 is the first version that provided the [tls] extra.
|
||||
# * Twisted-16.1.0 fixes https://twistedmatrix.com/trac/ticket/8223,
|
||||
# which otherwise causes test_system to fail (DirtyReactorError, due to
|
||||
# leftover timers)
|
||||
# * Twisted-16.4.0 introduces `python -m twisted.trial` which is needed
|
||||
# for coverage testing
|
||||
# * Twisted 16.6.0 drops the undesirable gmpy dependency from the conch
|
||||
# extra, letting us use that extra instead of trying to duplicate its
|
||||
# dependencies here. Twisted[conch] >18.7 introduces a dependency on
|
||||
# bcrypt. It is nice to avoid that if the user ends up with an older
|
||||
# version of Twisted. That's hard to express except by using the extra.
|
||||
#
|
||||
# * Twisted 18.4.0 adds `client` and `host` attributes to `Request` in the
|
||||
# * initializer, needed by logic in our custom `Request` subclass.
|
||||
#
|
||||
# In a perfect world, Twisted[conch] would be a dependency of an sftp
|
||||
# extra. However, pip fails to resolve the dependencies all
|
||||
# dependencies when asked for Twisted[tls] *and* Twisted[conch].
|
||||
# Specifically, Twisted[conch] (as the later requirement) is ignored.
|
||||
# If there were an Tahoe-LAFS sftp extra that dependended on
|
||||
# Twisted[conch] and install_requires only included Twisted[tls] then
|
||||
# `pip install tahoe-lafs[sftp]` would not install requirements
|
||||
# specified by Twisted[conch]. Since this would be the *whole point* of
|
||||
# an sftp extra in Tahoe-LAFS, there is no point in having one.
|
||||
# * Twisted 19.10 introduces Site.getContentFile which we use to get
|
||||
# temporary upload files placed into a per-node temporary directory.
|
||||
Twisted[tls,conch] >= 19.10.0
|
||||
|
||||
PyYAML >= 3.11
|
||||
|
||||
six >= 1.10.0
|
||||
|
||||
# for 'tahoe invite' and 'tahoe join'
|
||||
magic-wormhole >= 0.10.2
|
||||
|
||||
# A new enough version to support custom JSON encoders.
|
||||
eliot >= 1.13.0
|
||||
|
||||
# Pyrsistent 0.17.0 (which we use by way of Eliot) has dropped
|
||||
# Python 2 entirely; stick to the version known to work for us.
|
||||
pyrsistent
|
||||
|
||||
# A great way to define types of values.
|
||||
attrs >= 18.2.0
|
||||
|
||||
# WebSocket library for twisted and asyncio
|
||||
autobahn >= 19.5.2
|
||||
|
||||
# Support for Python 3 transition
|
||||
future >= 0.18.2
|
||||
|
||||
# Discover local network configuration
|
||||
netifaces
|
||||
|
||||
# Utility code:
|
||||
pyutil >= 3.3.0
|
||||
|
||||
# Linux distribution detection:
|
||||
distro >= 1.4.0
|
||||
|
||||
# For the RangeMap datastructure. Need 2.0.2 at least for bugfixes.
|
||||
collections-extended >= 2.0.2
|
||||
|
||||
# Duplicate the Twisted pywin32 dependency here. See
|
||||
# https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2392 for some
|
||||
# discussion.
|
||||
pywin32 != 226 ; sys_platform=="win32"
|
||||
|
||||
# HTTP server and client
|
||||
klein
|
||||
|
||||
# 2.2.0 has a bug: https://github.com/pallets/werkzeug/issues/2465
|
||||
werkzeug != 2.2.0
|
||||
treq
|
||||
cbor2
|
||||
pycddl >= 0.2
|
||||
|
||||
# for pid-file support
|
||||
psutil
|
||||
filelock
|
||||
|
||||
[options.packages.find]
|
||||
# inform the setuptools source discovery logic to start in this directory
|
||||
where = src
|
||||
|
||||
[options.package_data]
|
||||
allmydata.web =
|
||||
*.xhtml
|
||||
static/*.js
|
||||
static/*.png
|
||||
static/*.css
|
||||
static/img/*.png
|
||||
static/css/*.css
|
||||
|
||||
[options.extras_require]
|
||||
build =
|
||||
dulwich
|
||||
gpg
|
||||
|
||||
test =
|
||||
flake8
|
||||
# On Python 3.7, importlib_metadata v5 breaks flake8.
|
||||
# https://github.com/python/importlib_metadata/issues/407
|
||||
importlib_metadata < 5; python_version < "3.8"
|
||||
|
||||
# Pin a specific pyflakes so we don't have different folks
|
||||
# disagreeing on what is or is not a lint issue. We can bump
|
||||
# this version from time to time, but we will do it
|
||||
# intentionally.
|
||||
pyflakes == 2.2.0
|
||||
coverage ~= 5.0
|
||||
mock
|
||||
tox
|
||||
pytest
|
||||
pytest-twisted
|
||||
hypothesis >= 3.6.1
|
||||
towncrier
|
||||
testtools
|
||||
fixtures
|
||||
beautifulsoup4
|
||||
html5lib
|
||||
junitxml
|
||||
tenacity
|
||||
# Pin old version until
|
||||
# https://github.com/paramiko/paramiko/issues/1961 is fixed.
|
||||
paramiko < 2.9
|
||||
pytest-timeout
|
||||
# Does our OpenMetrics endpoint adhere to the spec:
|
||||
prometheus-client == 0.11.0
|
||||
|
||||
# Make sure the tor and i2p tests can run by duplicating the requirements
|
||||
# for those extras here.
|
||||
%(tor)s
|
||||
%(i2p)s
|
||||
|
||||
tor =
|
||||
# This is exactly what `foolscap[tor]` means but pip resolves the pair of
|
||||
# dependencies "foolscap[i2p] foolscap[tor]" to "foolscap[i2p]" so we lose
|
||||
# this if we don't declare it ourselves!
|
||||
txtorcon >= 0.17.0
|
||||
|
||||
i2p =
|
||||
# txi2p has Python 3 support in master branch, but it has not been
|
||||
# released -- see https://github.com/str4d/txi2p/issues/10. We
|
||||
# could use a fork for Python 3 until txi2p's maintainers are back
|
||||
# in action. For Python 2, we could continue using the txi2p
|
||||
# version about which no one has complained to us so far.
|
||||
txi2p-tahoe >= 0.3.5
|
||||
|
||||
[options.entry_points]
|
||||
console_scripts =
|
||||
tahoe = allmydata.scripts.runner:run
|
||||
|
||||
[flake8]
|
||||
# Enforce all pyflakes constraints, and also prohibit tabs for indentation.
|
||||
|
|
433
setup.py
433
setup.py
|
@ -1,431 +1,2 @@
|
|||
#! /usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
|
||||
# Tahoe-LAFS -- secure, distributed storage grid
|
||||
#
|
||||
# Copyright © 2006-2012 The Tahoe-LAFS Software Foundation
|
||||
#
|
||||
# This file is part of Tahoe-LAFS.
|
||||
#
|
||||
# See the docs/about.rst file for licensing information.
|
||||
|
||||
import os, subprocess, re
|
||||
from io import open
|
||||
|
||||
basedir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
# locate our version number
|
||||
|
||||
def read_version_py(infname):
|
||||
try:
|
||||
verstrline = open(infname, "rt").read()
|
||||
except EnvironmentError:
|
||||
return None
|
||||
else:
|
||||
VSRE = r"^verstr = ['\"]([^'\"]*)['\"]"
|
||||
mo = re.search(VSRE, verstrline, re.M)
|
||||
if mo:
|
||||
return mo.group(1)
|
||||
|
||||
VERSION_PY_FILENAME = 'src/allmydata/_version.py'
|
||||
version = read_version_py(VERSION_PY_FILENAME)
|
||||
|
||||
install_requires = [
|
||||
# we don't need much out of setuptools but the version checking stuff
|
||||
# needs pkg_resources and PEP 440 version specifiers.
|
||||
"setuptools >= 28.8.0",
|
||||
|
||||
"zfec >= 1.1.0",
|
||||
|
||||
# zope.interface >= 3.6.0 is required for Twisted >= 12.1.0.
|
||||
"zope.interface >= 3.6.0",
|
||||
|
||||
# * foolscap < 0.5.1 had a performance bug which spent O(N**2) CPU for
|
||||
# transferring large mutable files of size N.
|
||||
# * foolscap < 0.6 is incompatible with Twisted 10.2.0.
|
||||
# * foolscap 0.6.1 quiets a DeprecationWarning.
|
||||
# * foolscap < 0.6.3 is incompatible with Twisted 11.1.0 and newer.
|
||||
# * foolscap 0.8.0 generates 2048-bit RSA-with-SHA-256 signatures,
|
||||
# rather than 1024-bit RSA-with-MD5. This also allows us to work
|
||||
# with a FIPS build of OpenSSL.
|
||||
# * foolscap >= 0.12.3 provides tcp/tor/i2p connection handlers we need,
|
||||
# and allocate_tcp_port
|
||||
# * foolscap >= 0.12.5 has ConnectionInfo and ReconnectionInfo
|
||||
# * foolscap >= 0.12.6 has an i2p.sam_endpoint() that takes kwargs
|
||||
# * foolscap 0.13.2 drops i2p support completely
|
||||
# * foolscap >= 21.7 is necessary for Python 3 with i2p support.
|
||||
"foolscap >= 21.7.0",
|
||||
|
||||
# * cryptography 2.6 introduced some ed25519 APIs we rely on. Note that
|
||||
# Twisted[conch] also depends on cryptography and Twisted[tls]
|
||||
# transitively depends on cryptography. So it's anyone's guess what
|
||||
# version of cryptography will *really* be installed.
|
||||
"cryptography >= 2.6",
|
||||
|
||||
# * The SFTP frontend depends on Twisted 11.0.0 to fix the SSH server
|
||||
# rekeying bug <https://twistedmatrix.com/trac/ticket/4395>
|
||||
# * The SFTP frontend and manhole depend on the conch extra. However, we
|
||||
# can't explicitly declare that without an undesirable dependency on gmpy,
|
||||
# as explained in ticket #2740.
|
||||
# * Due to a setuptools bug, we need to declare a dependency on the tls
|
||||
# extra even though we only depend on it via foolscap.
|
||||
# * Twisted >= 15.1.0 is the first version that provided the [tls] extra.
|
||||
# * Twisted-16.1.0 fixes https://twistedmatrix.com/trac/ticket/8223,
|
||||
# which otherwise causes test_system to fail (DirtyReactorError, due to
|
||||
# leftover timers)
|
||||
# * Twisted-16.4.0 introduces `python -m twisted.trial` which is needed
|
||||
# for coverage testing
|
||||
# * Twisted 16.6.0 drops the undesirable gmpy dependency from the conch
|
||||
# extra, letting us use that extra instead of trying to duplicate its
|
||||
# dependencies here. Twisted[conch] >18.7 introduces a dependency on
|
||||
# bcrypt. It is nice to avoid that if the user ends up with an older
|
||||
# version of Twisted. That's hard to express except by using the extra.
|
||||
#
|
||||
# * Twisted 18.4.0 adds `client` and `host` attributes to `Request` in the
|
||||
# * initializer, needed by logic in our custom `Request` subclass.
|
||||
#
|
||||
# In a perfect world, Twisted[conch] would be a dependency of an "sftp"
|
||||
# extra. However, pip fails to resolve the dependencies all
|
||||
# dependencies when asked for Twisted[tls] *and* Twisted[conch].
|
||||
# Specifically, "Twisted[conch]" (as the later requirement) is ignored.
|
||||
# If there were an Tahoe-LAFS sftp extra that dependended on
|
||||
# Twisted[conch] and install_requires only included Twisted[tls] then
|
||||
# `pip install tahoe-lafs[sftp]` would not install requirements
|
||||
# specified by Twisted[conch]. Since this would be the *whole point* of
|
||||
# an sftp extra in Tahoe-LAFS, there is no point in having one.
|
||||
# * Twisted 19.10 introduces Site.getContentFile which we use to get
|
||||
# temporary upload files placed into a per-node temporary directory.
|
||||
"Twisted[tls,conch] >= 19.10.0",
|
||||
|
||||
"PyYAML >= 3.11",
|
||||
|
||||
"six >= 1.10.0",
|
||||
|
||||
# for 'tahoe invite' and 'tahoe join'
|
||||
"magic-wormhole >= 0.10.2",
|
||||
|
||||
# We want a new enough version to support custom JSON encoders.
|
||||
"eliot >= 1.13.0",
|
||||
|
||||
"pyrsistent",
|
||||
|
||||
# A great way to define types of values.
|
||||
"attrs >= 18.2.0",
|
||||
|
||||
# WebSocket library for twisted and asyncio
|
||||
"autobahn < 22.4.1", # remove this when 22.4.3 is released
|
||||
|
||||
# Support for Python 3 transition
|
||||
"future >= 0.18.2",
|
||||
|
||||
# Discover local network configuration
|
||||
"netifaces",
|
||||
|
||||
# Utility code:
|
||||
"pyutil >= 3.3.0",
|
||||
|
||||
# Linux distribution detection:
|
||||
"distro >= 1.4.0",
|
||||
|
||||
# For the RangeMap datastructure. Need 2.0.2 at least for bugfixes.
|
||||
"collections-extended >= 2.0.2",
|
||||
|
||||
# HTTP server and client
|
||||
"klein",
|
||||
# 2.2.0 has a bug: https://github.com/pallets/werkzeug/issues/2465
|
||||
"werkzeug != 2.2.0",
|
||||
"treq",
|
||||
"cbor2",
|
||||
"pycddl >= 0.2",
|
||||
|
||||
# for pid-file support
|
||||
"psutil",
|
||||
"filelock",
|
||||
]
|
||||
|
||||
setup_requires = [
|
||||
'setuptools >= 28.8.0', # for PEP-440 style versions
|
||||
]
|
||||
|
||||
tor_requires = [
|
||||
# This is exactly what `foolscap[tor]` means but pip resolves the pair of
|
||||
# dependencies "foolscap[i2p] foolscap[tor]" to "foolscap[i2p]" so we lose
|
||||
# this if we don't declare it ourselves!
|
||||
"txtorcon >= 0.17.0",
|
||||
]
|
||||
|
||||
i2p_requires = [
|
||||
# txi2p has Python 3 support in master branch, but it has not been
|
||||
# released -- see https://github.com/str4d/txi2p/issues/10. We
|
||||
# could use a fork for Python 3 until txi2p's maintainers are back
|
||||
# in action. For Python 2, we could continue using the txi2p
|
||||
# version about which no one has complained to us so far.
|
||||
"txi2p; python_version < '3.0'",
|
||||
"txi2p-tahoe >= 0.3.5; python_version > '3.0'",
|
||||
]
|
||||
|
||||
if len(sys.argv) > 1 and sys.argv[1] == '--fakedependency':
|
||||
del sys.argv[1]
|
||||
install_requires += ["fakedependency >= 1.0.0"]
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
from setuptools import Command
|
||||
from setuptools.command import install
|
||||
|
||||
|
||||
trove_classifiers=[
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Environment :: Console",
|
||||
"Environment :: Web Environment",
|
||||
"License :: OSI Approved :: GNU General Public License (GPL)",
|
||||
"License :: DFSG approved",
|
||||
"License :: Other/Proprietary License",
|
||||
"Intended Audience :: Developers",
|
||||
"Intended Audience :: End Users/Desktop",
|
||||
"Intended Audience :: System Administrators",
|
||||
"Operating System :: Microsoft",
|
||||
"Operating System :: Microsoft :: Windows",
|
||||
"Operating System :: Unix",
|
||||
"Operating System :: POSIX :: Linux",
|
||||
"Operating System :: POSIX",
|
||||
"Operating System :: MacOS :: MacOS X",
|
||||
"Operating System :: OS Independent",
|
||||
"Natural Language :: English",
|
||||
"Programming Language :: C",
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Topic :: Utilities",
|
||||
"Topic :: System :: Systems Administration",
|
||||
"Topic :: System :: Filesystems",
|
||||
"Topic :: System :: Distributed Computing",
|
||||
"Topic :: Software Development :: Libraries",
|
||||
"Topic :: System :: Archiving :: Backup",
|
||||
"Topic :: System :: Archiving :: Mirroring",
|
||||
"Topic :: System :: Archiving",
|
||||
]
|
||||
|
||||
|
||||
GIT_VERSION_BODY = '''
|
||||
# This _version.py is generated from git metadata by the tahoe setup.py.
|
||||
|
||||
__pkgname__ = "%(pkgname)s"
|
||||
real_version = "%(version)s"
|
||||
full_version = "%(full)s"
|
||||
branch = "%(branch)s"
|
||||
verstr = "%(normalized)s"
|
||||
__version__ = verstr
|
||||
'''
|
||||
|
||||
def run_command(args, cwd=None):
|
||||
use_shell = sys.platform == "win32"
|
||||
try:
|
||||
p = subprocess.Popen(args, stdout=subprocess.PIPE, cwd=cwd, shell=use_shell)
|
||||
except EnvironmentError as e: # if this gives a SyntaxError, note that Tahoe-LAFS requires Python 3.7+
|
||||
print("Warning: unable to run %r." % (" ".join(args),))
|
||||
print(e)
|
||||
return None
|
||||
stdout = p.communicate()[0].strip()
|
||||
if p.returncode != 0:
|
||||
print("Warning: %r returned error code %r." % (" ".join(args), p.returncode))
|
||||
return None
|
||||
return stdout
|
||||
|
||||
|
||||
def versions_from_git(tag_prefix):
|
||||
# This runs 'git' from the directory that contains this file. That either
|
||||
# means someone ran a setup.py command (and this code is in
|
||||
# versioneer.py, thus the containing directory is the root of the source
|
||||
# tree), or someone ran a project-specific entry point (and this code is
|
||||
# in _version.py, thus the containing directory is somewhere deeper in
|
||||
# the source tree). This only gets called if the git-archive 'subst'
|
||||
# variables were *not* expanded, and _version.py hasn't already been
|
||||
# rewritten with a short version string, meaning we're inside a checked
|
||||
# out source tree.
|
||||
|
||||
# versions_from_git (as copied from python-versioneer) returns strings
|
||||
# like "1.9.0-25-gb73aba9-dirty", which means we're in a tree with
|
||||
# uncommited changes (-dirty), the latest checkin is revision b73aba9,
|
||||
# the most recent tag was 1.9.0, and b73aba9 has 25 commits that weren't
|
||||
# in 1.9.0 . The narrow-minded NormalizedVersion parser that takes our
|
||||
# output (meant to enable sorting of version strings) refuses most of
|
||||
# that. Tahoe uses a function named suggest_normalized_version() that can
|
||||
# handle "1.9.0.post25", so dumb down our output to match.
|
||||
|
||||
try:
|
||||
source_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
except NameError as e:
|
||||
# some py2exe/bbfreeze/non-CPython implementations don't do __file__
|
||||
print("Warning: unable to find version because we could not obtain the source directory.")
|
||||
print(e)
|
||||
return {}
|
||||
stdout = run_command(["git", "describe", "--tags", "--dirty", "--always"],
|
||||
cwd=source_dir)
|
||||
if stdout is None:
|
||||
# run_command already complained.
|
||||
return {}
|
||||
stdout = stdout.decode("ascii")
|
||||
if not stdout.startswith(tag_prefix):
|
||||
print("Warning: tag %r doesn't start with prefix %r." % (stdout, tag_prefix))
|
||||
return {}
|
||||
version = stdout[len(tag_prefix):]
|
||||
pieces = version.split("-")
|
||||
if len(pieces) == 1:
|
||||
normalized_version = pieces[0]
|
||||
else:
|
||||
normalized_version = "%s.post%s" % (pieces[0], pieces[1])
|
||||
|
||||
stdout = run_command(["git", "rev-parse", "HEAD"], cwd=source_dir)
|
||||
if stdout is None:
|
||||
# run_command already complained.
|
||||
return {}
|
||||
full = stdout.decode("ascii").strip()
|
||||
if version.endswith("-dirty"):
|
||||
full += "-dirty"
|
||||
normalized_version += ".dev0"
|
||||
|
||||
# Thanks to Jistanidiot at <http://stackoverflow.com/questions/6245570/get-current-branch-name>.
|
||||
stdout = run_command(["git", "rev-parse", "--abbrev-ref", "HEAD"], cwd=source_dir)
|
||||
branch = (stdout or b"unknown").decode("ascii").strip()
|
||||
|
||||
# this returns native strings (bytes on py2, unicode on py3)
|
||||
return {"version": version, "normalized": normalized_version,
|
||||
"full": full, "branch": branch}
|
||||
|
||||
# setup.cfg has an [aliases] section which runs "update_version" before many
|
||||
# commands (like "build" and "sdist") that need to know our package version
|
||||
# ahead of time. If you add different commands (or if we forgot some), you
|
||||
# may need to add it to setup.cfg and configure it to run update_version
|
||||
# before your command.
|
||||
|
||||
class UpdateVersion(Command):
|
||||
description = "update _version.py from revision-control metadata"
|
||||
user_options = install.install.user_options
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
def finalize_options(self):
|
||||
pass
|
||||
def run(self):
|
||||
global version
|
||||
verstr = version
|
||||
if os.path.isdir(os.path.join(basedir, ".git")):
|
||||
verstr = self.try_from_git()
|
||||
|
||||
if verstr:
|
||||
self.distribution.metadata.version = verstr
|
||||
else:
|
||||
print("""\
|
||||
********************************************************************
|
||||
Warning: no version information found. This may cause tests to fail.
|
||||
********************************************************************
|
||||
""")
|
||||
|
||||
def try_from_git(self):
|
||||
# If we change the release tag names, we must change this too
|
||||
versions = versions_from_git("tahoe-lafs-")
|
||||
|
||||
# setup.py might be run by either py2 or py3 (when run by tox, which
|
||||
# uses py3 on modern debian/ubuntu distros). We want this generated
|
||||
# file to contain native strings on both (str=bytes in py2,
|
||||
# str=unicode in py3)
|
||||
if versions:
|
||||
body = GIT_VERSION_BODY % {
|
||||
"pkgname": self.distribution.get_name(),
|
||||
"version": versions["version"],
|
||||
"normalized": versions["normalized"],
|
||||
"full": versions["full"],
|
||||
"branch": versions["branch"],
|
||||
}
|
||||
f = open(VERSION_PY_FILENAME, "wb")
|
||||
f.write(body.encode("ascii"))
|
||||
f.close()
|
||||
print("Wrote normalized version %r into '%s'" % (versions["normalized"], VERSION_PY_FILENAME))
|
||||
|
||||
return versions.get("normalized", None)
|
||||
|
||||
class PleaseUseTox(Command):
|
||||
user_options = []
|
||||
def initialize_options(self):
|
||||
pass
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
print("ERROR: Please use 'tox' to run the test suite.")
|
||||
sys.exit(1)
|
||||
|
||||
setup_args = {}
|
||||
if version:
|
||||
setup_args["version"] = version
|
||||
|
||||
setup(name="tahoe-lafs", # also set in __init__.py
|
||||
description='secure, decentralized, fault-tolerant file store',
|
||||
long_description=open('README.rst', 'r', encoding='utf-8').read(),
|
||||
author='the Tahoe-LAFS project',
|
||||
author_email='tahoe-dev@lists.tahoe-lafs.org',
|
||||
url='https://tahoe-lafs.org/',
|
||||
license='GNU GPL', # see README.rst -- there is an alternative licence
|
||||
cmdclass={"update_version": UpdateVersion,
|
||||
"test": PleaseUseTox,
|
||||
},
|
||||
package_dir = {'':'src'},
|
||||
packages=find_packages('src') + ['allmydata.test.plugins'],
|
||||
classifiers=trove_classifiers,
|
||||
# We support Python 3.7 or later. 3.11 is not supported yet.
|
||||
python_requires=">=3.7, <3.11",
|
||||
install_requires=install_requires,
|
||||
extras_require={
|
||||
# Duplicate the Twisted pywin32 dependency here. See
|
||||
# https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2392 for some
|
||||
# discussion.
|
||||
':sys_platform=="win32"': ["pywin32 != 226"],
|
||||
"build": [
|
||||
"dulwich",
|
||||
"gpg",
|
||||
],
|
||||
"test": [
|
||||
"flake8",
|
||||
# On Python 3.7, importlib_metadata v5 breaks flake8.
|
||||
# https://github.com/python/importlib_metadata/issues/407
|
||||
"importlib_metadata<5; python_version < '3.8'",
|
||||
# Pin a specific pyflakes so we don't have different folks
|
||||
# disagreeing on what is or is not a lint issue. We can bump
|
||||
# this version from time to time, but we will do it
|
||||
# intentionally.
|
||||
"pyflakes == 2.2.0",
|
||||
"coverage ~= 5.0",
|
||||
"mock",
|
||||
"tox",
|
||||
"pytest",
|
||||
"pytest-twisted",
|
||||
"hypothesis >= 3.6.1",
|
||||
"towncrier",
|
||||
"testtools",
|
||||
"fixtures",
|
||||
"beautifulsoup4",
|
||||
"html5lib",
|
||||
"junitxml",
|
||||
"tenacity",
|
||||
# Pin old version until
|
||||
# https://github.com/paramiko/paramiko/issues/1961 is fixed.
|
||||
"paramiko < 2.9",
|
||||
"pytest-timeout",
|
||||
# Does our OpenMetrics endpoint adhere to the spec:
|
||||
"prometheus-client == 0.11.0",
|
||||
] + tor_requires + i2p_requires,
|
||||
"tor": tor_requires,
|
||||
"i2p": i2p_requires,
|
||||
},
|
||||
package_data={"allmydata.web": ["*.xhtml",
|
||||
"static/*.js", "static/*.png", "static/*.css",
|
||||
"static/img/*.png",
|
||||
"static/css/*.css",
|
||||
],
|
||||
"allmydata": ["ported-modules.txt"],
|
||||
},
|
||||
include_package_data=True,
|
||||
setup_requires=setup_requires,
|
||||
entry_points = { 'console_scripts': [ 'tahoe = allmydata.scripts.runner:run' ] },
|
||||
**setup_args
|
||||
)
|
||||
from setuptools import setup
|
||||
setup()
|
||||
|
|
|
@ -3,55 +3,16 @@ Decentralized storage grid.
|
|||
|
||||
community web site: U{https://tahoe-lafs.org/}
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from future.utils import PY2, PY3
|
||||
if PY2:
|
||||
# Don't import future str() so we don't break Foolscap serialization on Python 2.
|
||||
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, max, min # noqa: F401
|
||||
from past.builtins import unicode as str
|
||||
|
||||
__all__ = [
|
||||
"__version__",
|
||||
"full_version",
|
||||
"branch",
|
||||
"__appname__",
|
||||
"__full_version__",
|
||||
]
|
||||
|
||||
__version__ = "unknown"
|
||||
try:
|
||||
# type ignored as it fails in CI
|
||||
# (https://app.circleci.com/pipelines/github/tahoe-lafs/tahoe-lafs/1647/workflows/60ae95d4-abe8-492c-8a03-1ad3b9e42ed3/jobs/40972)
|
||||
from allmydata._version import __version__ # type: ignore
|
||||
except ImportError:
|
||||
# We're running in a tree that hasn't run update_version, and didn't
|
||||
# come with a _version.py, so we don't know what our version is.
|
||||
# This should not happen very often.
|
||||
pass
|
||||
|
||||
full_version = "unknown"
|
||||
branch = "unknown"
|
||||
try:
|
||||
# type ignored as it fails in CI
|
||||
# (https://app.circleci.com/pipelines/github/tahoe-lafs/tahoe-lafs/1647/workflows/60ae95d4-abe8-492c-8a03-1ad3b9e42ed3/jobs/40972)
|
||||
from allmydata._version import full_version, branch # type: ignore
|
||||
except ImportError:
|
||||
# We're running in a tree that hasn't run update_version, and didn't
|
||||
# come with a _version.py, so we don't know what our full version or
|
||||
# branch is. This should not happen very often.
|
||||
pass
|
||||
|
||||
__appname__ = "tahoe-lafs"
|
||||
|
||||
# __full_version__ is the one that you ought to use when identifying yourself
|
||||
# in the "application" part of the Tahoe versioning scheme:
|
||||
# https://tahoe-lafs.org/trac/tahoe-lafs/wiki/Versioning
|
||||
__full_version__ = __appname__ + '/' + str(__version__)
|
||||
|
||||
from allmydata._version import __version__
|
||||
__full_version__ = f"{__appname__}/{__version__}"
|
||||
|
||||
# Install Python 3 module locations in Python 2:
|
||||
from future import standard_library
|
||||
|
@ -72,8 +33,7 @@ del patch
|
|||
#
|
||||
# Also note that BytesWarnings only happen if Python is run with -b option, so
|
||||
# in practice this should only affect tests.
|
||||
if PY3:
|
||||
import warnings
|
||||
# Error on BytesWarnings, to catch things like str(b""), but only for
|
||||
# allmydata code.
|
||||
warnings.filterwarnings("error", category=BytesWarning, module=".*allmydata.*")
|
||||
import warnings
|
||||
# Error on BytesWarnings, to catch things like str(b""), but only for
|
||||
# allmydata code.
|
||||
warnings.filterwarnings("error", category=BytesWarning, module=".*allmydata.*")
|
||||
|
|
7
tox.ini
7
tox.ini
|
@ -114,7 +114,7 @@ passenv = HOME
|
|||
setenv =
|
||||
# If no positional arguments are given, try to run the checks on the
|
||||
# entire codebase, including various pieces of supporting code.
|
||||
DEFAULT_FILES=src integration static misc setup.py
|
||||
DEFAULT_FILES=src integration static misc
|
||||
commands =
|
||||
flake8 {posargs:{env:DEFAULT_FILES}}
|
||||
python misc/coding_tools/check-umids.py {posargs:{env:DEFAULT_FILES}}
|
||||
|
@ -220,7 +220,6 @@ commands=
|
|||
|
||||
[testenv:tarballs]
|
||||
basepython = python3
|
||||
deps =
|
||||
deps = build
|
||||
commands =
|
||||
python setup.py update_version
|
||||
python setup.py sdist --formats=gztar bdist_wheel --universal
|
||||
python -m build
|
||||
|
|
Loading…
Reference in New Issue