replace tabs with spaces
This commit is contained in:
parent
ffc513763f
commit
ea1f96c246
309
setup.py
309
setup.py
|
@ -12,9 +12,9 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, write to:
|
# along with this program. If not, write to:
|
||||||
# The Free Software Foundation, Inc.,
|
# The Free Software Foundation, Inc.,
|
||||||
# 51 Franklin Street, Fifth Floor
|
# 51 Franklin Street, Fifth Floor
|
||||||
# Boston, MA 02110-1301, USA.
|
# Boston, MA 02110-1301, USA.
|
||||||
#
|
#
|
||||||
# In addition, as a special exception, the copyright holders give
|
# In addition, as a special exception, the copyright holders give
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
# permission to link the code of portions of this program with the OpenSSL
|
||||||
|
@ -28,45 +28,45 @@
|
||||||
|
|
||||||
NAME = "deluge"
|
NAME = "deluge"
|
||||||
FULLNAME = "Deluge BitTorrent Client"
|
FULLNAME = "Deluge BitTorrent Client"
|
||||||
VERSION = "0.5.3.90"
|
VERSION = "0.5.3.90"
|
||||||
AUTHOR = "Zach Tibbitts, Alon Zakai, Marcos Pinto, Andrew Resch, Alex Dedul"
|
AUTHOR = "Zach Tibbitts, Alon Zakai, Marcos Pinto, Andrew Resch, Alex Dedul"
|
||||||
EMAIL = "zach@collegegeek.org, kripkensteiner@gmail.com, marcospinto@dipconsultants.com, alonzakai@gmail.com, rotmer@gmail.com"
|
EMAIL = "zach@collegegeek.org, kripkensteiner@gmail.com, marcospinto@dipconsultants.com, alonzakai@gmail.com, rotmer@gmail.com"
|
||||||
DESCRIPTION = "A bittorrent client written in PyGTK"
|
DESCRIPTION = "A bittorrent client written in PyGTK"
|
||||||
URL = "http://deluge-torrent.org"
|
URL = "http://deluge-torrent.org"
|
||||||
LICENSE = "GPLv2"
|
LICENSE = "GPLv2"
|
||||||
|
|
||||||
import os, platform
|
import os, platform
|
||||||
print "Attempting to detect your system information"
|
print "Attempting to detect your system information"
|
||||||
if platform.machine() == "i386" or platform.machine() == "i686":
|
if platform.machine() == "i386" or platform.machine() == "i686":
|
||||||
print "32bit x86 system detected"
|
print "32bit x86 system detected"
|
||||||
ARCH = "x86"
|
ARCH = "x86"
|
||||||
elif platform.machine() == "x86_64" or platform.machine() == "amd64":
|
elif platform.machine() == "x86_64" or platform.machine() == "amd64":
|
||||||
print "64bit x86_64 system detected"
|
print "64bit x86_64 system detected"
|
||||||
ARCH = "x64"
|
ARCH = "x64"
|
||||||
elif platform.machine() == "ppc":
|
elif platform.machine() == "ppc":
|
||||||
print "PowerPC system detected"
|
print "PowerPC system detected"
|
||||||
ARCH = "ppc"
|
ARCH = "ppc"
|
||||||
else:
|
else:
|
||||||
print "Couldn't detect CPU architecture"
|
print "Couldn't detect CPU architecture"
|
||||||
ARCH = ""
|
ARCH = ""
|
||||||
if platform.system() == "Linux":
|
if platform.system() == "Linux":
|
||||||
print "Linux operating system detected"
|
print "Linux operating system detected"
|
||||||
OS = "linux"
|
OS = "linux"
|
||||||
elif platform.system() == "Darwin" :
|
elif platform.system() == "Darwin" :
|
||||||
print "Darwin / OS X system detected"
|
print "Darwin / OS X system detected"
|
||||||
OS = "osx"
|
OS = "osx"
|
||||||
elif platform.system() == "FreeBSD" :
|
elif platform.system() == "FreeBSD" :
|
||||||
print "FreeBSD operating system detected"
|
print "FreeBSD operating system detected"
|
||||||
OS = "freebsd"
|
OS = "freebsd"
|
||||||
elif platform.system() == "Windows":
|
elif platform.system() == "Windows":
|
||||||
print "Windows system detected"
|
print "Windows system detected"
|
||||||
OS = "win"
|
OS = "win"
|
||||||
elif os.name == "posix":
|
elif os.name == "posix":
|
||||||
print "Unix system detected"
|
print "Unix system detected"
|
||||||
OS = "nix"
|
OS = "nix"
|
||||||
else:
|
else:
|
||||||
print "Couldn't detect operating system"
|
print "Couldn't detect operating system"
|
||||||
OS = ""
|
OS = ""
|
||||||
import os.path, glob
|
import os.path, glob
|
||||||
from distutils.core import setup, Extension
|
from distutils.core import setup, Extension
|
||||||
from distutils import sysconfig
|
from distutils import sysconfig
|
||||||
|
@ -85,55 +85,56 @@ python_version = platform.python_version()[0:3]
|
||||||
# deluge_core. While we understand that you aren't generally
|
# deluge_core. While we understand that you aren't generally
|
||||||
# encouraged to do this, we have done so for the following reasons:
|
# encouraged to do this, we have done so for the following reasons:
|
||||||
# 1) The -g compiler option produces debugging information about
|
# 1) The -g compiler option produces debugging information about
|
||||||
# the compiled module. However, this option increases the
|
# the compiled module. However, this option increases the
|
||||||
# size of deluge_core.so from ~1.9MB to 13.6MB and slows down
|
# size of deluge_core.so from ~1.9MB to 13.6MB and slows down
|
||||||
# the program's execution without offering any benefits
|
# the program's execution without offering any benefits
|
||||||
# whatsoever.
|
# whatsoever.
|
||||||
# 2) -Wstrict-prototypes is not a valid C++ build option, and the
|
# 2) -Wstrict-prototypes is not a valid C++ build option, and the
|
||||||
# compiler will throw a number of warnings at compile time.
|
# compiler will throw a number of warnings at compile time.
|
||||||
# While this does not really impact anything, it makes it
|
# While this does not really impact anything, it makes it
|
||||||
# seem as if something is going wrong with the compile, and
|
# seem as if something is going wrong with the compile, and
|
||||||
# it has been removed to prevent confusion.
|
# it has been removed to prevent confusion.
|
||||||
|
|
||||||
if not OS == "win":
|
if not OS == "win":
|
||||||
EXTRA_COMPILE_ARGS = ["-Wno-missing-braces",
|
EXTRA_COMPILE_ARGS = ["-Wno-missing-braces",
|
||||||
"-DHAVE_INCLUDE_LIBTORRENT_ASIO____ASIO_HPP=1",
|
"-DHAVE_INCLUDE_LIBTORRENT_ASIO____ASIO_HPP=1",
|
||||||
"-DHAVE_INCLUDE_LIBTORRENT_ASIO_SSL_STREAM_HPP=1",
|
"-DHAVE_INCLUDE_LIBTORRENT_ASIO_SSL_STREAM_HPP=1",
|
||||||
"-DHAVE_INCLUDE_LIBTORRENT_ASIO_IP_TCP_HPP=1",
|
"-DHAVE_INCLUDE_LIBTORRENT_ASIO_IP_TCP_HPP=1",
|
||||||
"-DHAVE_PTHREAD=1", "-DTORRENT_USE_OPENSSL=1", "-DHAVE_SSL=1",
|
"-DHAVE_PTHREAD=1", "-DTORRENT_USE_OPENSSL=1", "-DHAVE_SSL=1",
|
||||||
"-DNDEBUG=1"]
|
"-DNDEBUG=1"]
|
||||||
if ARCH == "x64":
|
if ARCH == "x64":
|
||||||
EXTRA_COMPILE_ARGS.append("-DAMD64")
|
EXTRA_COMPILE_ARGS.append("-DAMD64")
|
||||||
|
|
||||||
includedirs = ['./libtorrent', './libtorrent/include',
|
includedirs = ['./libtorrent', './libtorrent/include',
|
||||||
'./libtorrent/include/libtorrent',
|
'./libtorrent/include/libtorrent',
|
||||||
'/usr/include/python' + python_version]
|
'/usr/include/python' + python_version]
|
||||||
|
|
||||||
if OS == "linux":
|
if OS == "linux":
|
||||||
if os.WEXITSTATUS(os.system('grep -iq "Debian GNU/Linux 4.0\|Ubuntu 7.04\|Ubuntu 6.06\|Ubuntu 6.10\|Fedora Core release 6\|openSUSE 10.2\|Mandriva Linux release 2007.1\|Fedora release 7\|BLAG release 60001\|Yellow Dog Linux release 5.0 (Phoenix)\|CentOS release 5 (Final)" /etc/issue')) == 0:
|
if os.WEXITSTATUS(os.system('grep -iq "Debian GNU/Linux 4.0\|Ubuntu 7.04\|Ubuntu 6.06\|Ubuntu 6.10\|Fedora Core release 6\|openSUSE 10.2\|Mandriva Linux release 2007.1\|Fedora release 7\|BLAG release 60001\|Yellow Dog Linux release 5.0 (Phoenix)\|CentOS release 5 (Final)" /etc/issue')) == 0:
|
||||||
boosttype = 'nomt'
|
boosttype = 'nomt'
|
||||||
else:
|
else:
|
||||||
boosttype = 'mt'
|
boosttype = 'mt'
|
||||||
elif OS == "freebsd":
|
elif OS == "freebsd":
|
||||||
boosttype = 'nomt'
|
boosttype = 'nomt'
|
||||||
else:
|
else:
|
||||||
boosttype = 'mt'
|
boosttype = 'mt'
|
||||||
|
|
||||||
removals = ['-g', '-Wstrict-prototypes']
|
removals = ['-g', '-Wstrict-prototypes']
|
||||||
|
|
||||||
if python_version == '2.5':
|
if python_version == '2.5':
|
||||||
cv_opt = sysconfig.get_config_vars()["CFLAGS"]
|
cv_opt = sysconfig.get_config_vars()["CFLAGS"]
|
||||||
for removal in removals:
|
for removal in removals:
|
||||||
cv_opt = cv_opt.replace(removal, " ")
|
cv_opt = cv_opt.replace(removal, " ")
|
||||||
sysconfig.get_config_vars()["CFLAGS"] = ' '.join(cv_opt.split())
|
sysconfig.get_config_vars()["CFLAGS"] = ' '.join(cv_opt.split())
|
||||||
else:
|
else:
|
||||||
cv_opt = sysconfig.get_config_vars()["OPT"]
|
cv_opt = sysconfig.get_config_vars()["OPT"]
|
||||||
for removal in removals:
|
for removal in removals:
|
||||||
cv_opt = cv_opt.replace(removal, " ")
|
cv_opt = cv_opt.replace(removal, " ")
|
||||||
sysconfig.get_config_vars()["OPT"] = ' '.join(cv_opt.split())
|
sysconfig.get_config_vars()["OPT"] = ' '.join(cv_opt.split())
|
||||||
else:
|
else:
|
||||||
boosttype = 'mt'
|
boosttype = 'mt'
|
||||||
EXTRA_COMPILE_ARGS = ['/link /LIBPATH: C:\Program Files\boost\boost_1_34_0\lib']
|
EXTRA_COMPILE_ARGS = ['/link /LIBPATH: C:\Program Files\boost\boost_1_34_0\lib']
|
||||||
includedirs = ['./libtorrent', './libtorrent/include',
|
includedirs = ['./libtorrent', './libtorrent/include',
|
||||||
'./libtorrent/include/libtorrent',
|
'./libtorrent/include/libtorrent',
|
||||||
'c:\Python25\include', 'c:\win32-build-deps\include']
|
'c:\Python25\include', 'c:\win32-build-deps\include']
|
||||||
|
|
||||||
|
@ -148,13 +149,13 @@ else:
|
||||||
# moment, we are including the source code to make packaging on Debian and
|
# moment, we are including the source code to make packaging on Debian and
|
||||||
# Ubuntu possible.
|
# Ubuntu possible.
|
||||||
if boosttype == "nomt":
|
if boosttype == "nomt":
|
||||||
librariestype = ['boost_filesystem', 'boost_date_time',
|
librariestype = ['boost_filesystem', 'boost_date_time',
|
||||||
'boost_thread', 'z', 'pthread', 'ssl']
|
'boost_thread', 'z', 'pthread', 'ssl']
|
||||||
print 'Libraries nomt'
|
print 'Libraries nomt'
|
||||||
elif boosttype == "mt":
|
elif boosttype == "mt":
|
||||||
librariestype = ['boost_filesystem-mt', 'boost_date_time-mt',
|
librariestype = ['boost_filesystem', 'boost_date_time',
|
||||||
'boost_thread-mt', 'z', 'pthread', 'ssl']
|
'boost_thread', 'z', 'pthread', 'ssl']
|
||||||
print 'Libraries mt'
|
print 'Libraries mt'
|
||||||
|
|
||||||
def fetchCpp():
|
def fetchCpp():
|
||||||
for root,dirs,files in os.walk('libtorrent'):
|
for root,dirs,files in os.walk('libtorrent'):
|
||||||
|
@ -167,116 +168,116 @@ def fetchCpp():
|
||||||
sources=list(fetchCpp())
|
sources=list(fetchCpp())
|
||||||
sources.append(os.path.join('src','deluge_core.cpp'))
|
sources.append(os.path.join('src','deluge_core.cpp'))
|
||||||
if not OS == "win":
|
if not OS == "win":
|
||||||
sources.remove('libtorrent/src/file_win.cpp')
|
sources.remove('libtorrent/src/file_win.cpp')
|
||||||
|
|
||||||
|
|
||||||
deluge_core = Extension('deluge_core',
|
deluge_core = Extension('deluge_core',
|
||||||
include_dirs = includedirs,
|
include_dirs = includedirs,
|
||||||
libraries = librariestype,
|
libraries = librariestype,
|
||||||
extra_compile_args = EXTRA_COMPILE_ARGS,
|
extra_compile_args = EXTRA_COMPILE_ARGS,
|
||||||
sources = sources)
|
sources = sources)
|
||||||
# Thanks to Iain Nicol for code to save the location for installed prefix
|
# Thanks to Iain Nicol for code to save the location for installed prefix
|
||||||
# At runtime, we need to know where we installed the data to.
|
# At runtime, we need to know where we installed the data to.
|
||||||
|
|
||||||
class write_data_install_path(cmd.Command):
|
class write_data_install_path(cmd.Command):
|
||||||
description = 'saves the data installation path for access at runtime'
|
description = 'saves the data installation path for access at runtime'
|
||||||
|
|
||||||
def initialize_options(self):
|
def initialize_options(self):
|
||||||
self.prefix = None
|
self.prefix = None
|
||||||
self.lib_build_dir = None
|
self.lib_build_dir = None
|
||||||
|
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
self.set_undefined_options('install',
|
self.set_undefined_options('install',
|
||||||
('prefix', 'prefix')
|
('prefix', 'prefix')
|
||||||
)
|
)
|
||||||
self.set_undefined_options('build',
|
self.set_undefined_options('build',
|
||||||
('build_lib', 'lib_build_dir')
|
('build_lib', 'lib_build_dir')
|
||||||
)
|
)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
conf_filename = os.path.join(self.lib_build_dir,
|
conf_filename = os.path.join(self.lib_build_dir,
|
||||||
'deluge', 'common.py')
|
'deluge', 'common.py')
|
||||||
|
|
||||||
conf_file = open(conf_filename, 'r')
|
conf_file = open(conf_filename, 'r')
|
||||||
data = conf_file.read()
|
data = conf_file.read()
|
||||||
conf_file.close()
|
conf_file.close()
|
||||||
data = data.replace('@datadir@', self.prefix)
|
data = data.replace('@datadir@', self.prefix)
|
||||||
conf_file = open(conf_filename, 'w')
|
conf_file = open(conf_filename, 'w')
|
||||||
conf_file.write(data)
|
conf_file.write(data)
|
||||||
conf_file.close()
|
conf_file.close()
|
||||||
|
|
||||||
class unwrite_data_install_path(cmd.Command):
|
class unwrite_data_install_path(cmd.Command):
|
||||||
description = 'undoes write_data_install_path'
|
description = 'undoes write_data_install_path'
|
||||||
|
|
||||||
def initialize_options(self):
|
def initialize_options(self):
|
||||||
self.lib_build_dir = None
|
self.lib_build_dir = None
|
||||||
|
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
self.set_undefined_options('build',
|
self.set_undefined_options('build',
|
||||||
('build_lib', 'lib_build_dir')
|
('build_lib', 'lib_build_dir')
|
||||||
)
|
)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
dest = os.path.join(self.lib_build_dir,
|
dest = os.path.join(self.lib_build_dir,
|
||||||
'deluge', 'common.py')
|
'deluge', 'common.py')
|
||||||
shutil.copyfile('src/common.py', dest)
|
shutil.copyfile('src/common.py', dest)
|
||||||
|
|
||||||
class build_trans(cmd.Command):
|
class build_trans(cmd.Command):
|
||||||
description = 'Compile .po files into .mo files'
|
description = 'Compile .po files into .mo files'
|
||||||
|
|
||||||
def initialize_options(self):
|
def initialize_options(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
po_dir = os.path.join(os.path.dirname(os.curdir), 'po')
|
po_dir = os.path.join(os.path.dirname(os.curdir), 'po')
|
||||||
for path, names, filenames in os.walk(po_dir):
|
for path, names, filenames in os.walk(po_dir):
|
||||||
for f in filenames:
|
for f in filenames:
|
||||||
if f.endswith('.po'):
|
if f.endswith('.po'):
|
||||||
lang = f[:len(f) - 3]
|
lang = f[:len(f) - 3]
|
||||||
src = os.path.join(path, f)
|
src = os.path.join(path, f)
|
||||||
dest_path = os.path.join('build', 'locale', lang, 'LC_MESSAGES')
|
dest_path = os.path.join('build', 'locale', lang, 'LC_MESSAGES')
|
||||||
dest = os.path.join(dest_path, 'deluge.mo')
|
dest = os.path.join(dest_path, 'deluge.mo')
|
||||||
if not os.path.exists(dest_path):
|
if not os.path.exists(dest_path):
|
||||||
os.makedirs(dest_path)
|
os.makedirs(dest_path)
|
||||||
if not os.path.exists(dest):
|
if not os.path.exists(dest):
|
||||||
print 'Compiling %s' % src
|
print 'Compiling %s' % src
|
||||||
msgfmt.make(src, dest)
|
msgfmt.make(src, dest)
|
||||||
else:
|
else:
|
||||||
src_mtime = os.stat(src)[8]
|
src_mtime = os.stat(src)[8]
|
||||||
dest_mtime = os.stat(dest)[8]
|
dest_mtime = os.stat(dest)[8]
|
||||||
if src_mtime > dest_mtime:
|
if src_mtime > dest_mtime:
|
||||||
print 'Compiling %s' % src
|
print 'Compiling %s' % src
|
||||||
msgfmt.make(src, dest)
|
msgfmt.make(src, dest)
|
||||||
|
|
||||||
class build(_build):
|
class build(_build):
|
||||||
sub_commands = _build.sub_commands + [('build_trans', None)]
|
sub_commands = _build.sub_commands + [('build_trans', None)]
|
||||||
def run(self):
|
def run(self):
|
||||||
_build.run(self)
|
_build.run(self)
|
||||||
|
|
||||||
class install(_install):
|
class install(_install):
|
||||||
sub_commands = [('write_data_install_path', None)] + \
|
sub_commands = [('write_data_install_path', None)] + \
|
||||||
_install.sub_commands + [('unwrite_data_install_path', None)]
|
_install.sub_commands + [('unwrite_data_install_path', None)]
|
||||||
def run(self):
|
def run(self):
|
||||||
_install.run(self)
|
_install.run(self)
|
||||||
|
|
||||||
class install_data(_install_data):
|
class install_data(_install_data):
|
||||||
def run(self):
|
def run(self):
|
||||||
for lang in os.listdir('build/locale/'):
|
for lang in os.listdir('build/locale/'):
|
||||||
lang_dir = os.path.join('share', 'locale', lang, 'LC_MESSAGES')
|
lang_dir = os.path.join('share', 'locale', lang, 'LC_MESSAGES')
|
||||||
lang_file = os.path.join('build', 'locale', lang, 'LC_MESSAGES', 'deluge.mo')
|
lang_file = os.path.join('build', 'locale', lang, 'LC_MESSAGES', 'deluge.mo')
|
||||||
self.data_files.append( (lang_dir, [lang_file]) )
|
self.data_files.append( (lang_dir, [lang_file]) )
|
||||||
_install_data.run(self)
|
_install_data.run(self)
|
||||||
|
|
||||||
cmdclass = {
|
cmdclass = {
|
||||||
'build': build,
|
'build': build,
|
||||||
'install': install,
|
'install': install,
|
||||||
'build_trans': build_trans,
|
'build_trans': build_trans,
|
||||||
'install_data': install_data,
|
'install_data': install_data,
|
||||||
'write_data_install_path': write_data_install_path,
|
'write_data_install_path': write_data_install_path,
|
||||||
'unwrite_data_install_path': unwrite_data_install_path,
|
'unwrite_data_install_path': unwrite_data_install_path,
|
||||||
}
|
}
|
||||||
|
|
||||||
data = [('share/deluge/glade', glob.glob('glade/*.glade')),
|
data = [('share/deluge/glade', glob.glob('glade/*.glade')),
|
||||||
|
@ -285,16 +286,16 @@ data = [('share/deluge/glade', glob.glob('glade/*.glade')),
|
||||||
('share/pixmaps' , ['deluge.png'])]
|
('share/pixmaps' , ['deluge.png'])]
|
||||||
|
|
||||||
for plugin in glob.glob('plugins/*'):
|
for plugin in glob.glob('plugins/*'):
|
||||||
data.append( ('share/deluge/' + plugin, glob.glob(plugin + '/*')) )
|
data.append( ('share/deluge/' + plugin, glob.glob(plugin + '/*')) )
|
||||||
|
|
||||||
setup(name=NAME, fullname=FULLNAME, version=VERSION,
|
setup(name=NAME, fullname=FULLNAME, version=VERSION,
|
||||||
author=AUTHOR, author_email=EMAIL, description=DESCRIPTION,
|
author=AUTHOR, author_email=EMAIL, description=DESCRIPTION,
|
||||||
url=URL, license=LICENSE,
|
url=URL, license=LICENSE,
|
||||||
scripts=["scripts/deluge"],
|
scripts=["scripts/deluge"],
|
||||||
packages=['deluge'],
|
packages=['deluge'],
|
||||||
package_dir = {'deluge': 'src'},
|
package_dir = {'deluge': 'src'},
|
||||||
data_files=data,
|
data_files=data,
|
||||||
ext_package='deluge',
|
ext_package='deluge',
|
||||||
ext_modules=[deluge_core],
|
ext_modules=[deluge_core],
|
||||||
cmdclass=cmdclass
|
cmdclass=cmdclass
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue