mirror of
https://git.deluge-torrent.org/deluge
synced 2025-04-20 11:35:49 +00:00
install to different prefix. thanks orra
This commit is contained in:
parent
93378db25d
commit
03c7228184
2 changed files with 101 additions and 37 deletions
130
setup.py
130
setup.py
|
@ -53,38 +53,38 @@ deluge_core = Extension('deluge_core',
|
|||
'boost_serialization', 'boost_thread', 'z', 'pthread'],
|
||||
extra_compile_args = ["-Wno-missing-braces"],
|
||||
sources = ['src/deluge_core.cpp',
|
||||
'libtorrent/src/alert.cpp',
|
||||
'libtorrent/src/allocate_resources.cpp',
|
||||
'libtorrent/src/bt_peer_connection.cpp',
|
||||
'libtorrent/src/entry.cpp',
|
||||
'libtorrent/src/escape_string.cpp',
|
||||
'libtorrent/src/file.cpp',
|
||||
'libtorrent/src/http_tracker_connection.cpp',
|
||||
'libtorrent/src/identify_client.cpp',
|
||||
'libtorrent/src/ip_filter.cpp',
|
||||
'libtorrent/src/peer_connection.cpp',
|
||||
'libtorrent/src/piece_picker.cpp',
|
||||
'libtorrent/src/policy.cpp',
|
||||
'libtorrent/src/session.cpp',
|
||||
'libtorrent/src/session_impl.cpp',
|
||||
'libtorrent/src/sha1.cpp',
|
||||
'libtorrent/src/stat.cpp',
|
||||
'libtorrent/src/storage.cpp',
|
||||
'libtorrent/src/torrent.cpp',
|
||||
'libtorrent/src/torrent_handle.cpp',
|
||||
'libtorrent/src/torrent_info.cpp',
|
||||
'libtorrent/src/tracker_manager.cpp',
|
||||
'libtorrent/src/udp_tracker_connection.cpp',
|
||||
'libtorrent/src/web_peer_connection.cpp',
|
||||
'libtorrent/src/kademlia/closest_nodes.cpp',
|
||||
'libtorrent/src/kademlia/dht_tracker.cpp',
|
||||
'libtorrent/src/kademlia/find_data.cpp',
|
||||
'libtorrent/src/kademlia/node.cpp',
|
||||
'libtorrent/src/kademlia/node_id.cpp',
|
||||
'libtorrent/src/kademlia/refresh.cpp',
|
||||
'libtorrent/src/kademlia/routing_table.cpp',
|
||||
'libtorrent/src/kademlia/rpc_manager.cpp',
|
||||
'libtorrent/src/kademlia/traversal_algorithm.cpp'])
|
||||
'libtorrent/src/alert.cpp',
|
||||
'libtorrent/src/allocate_resources.cpp',
|
||||
'libtorrent/src/bt_peer_connection.cpp',
|
||||
'libtorrent/src/entry.cpp',
|
||||
'libtorrent/src/escape_string.cpp',
|
||||
'libtorrent/src/file.cpp',
|
||||
'libtorrent/src/http_tracker_connection.cpp',
|
||||
'libtorrent/src/identify_client.cpp',
|
||||
'libtorrent/src/ip_filter.cpp',
|
||||
'libtorrent/src/peer_connection.cpp',
|
||||
'libtorrent/src/piece_picker.cpp',
|
||||
'libtorrent/src/policy.cpp',
|
||||
'libtorrent/src/session.cpp',
|
||||
'libtorrent/src/session_impl.cpp',
|
||||
'libtorrent/src/sha1.cpp',
|
||||
'libtorrent/src/stat.cpp',
|
||||
'libtorrent/src/storage.cpp',
|
||||
'libtorrent/src/torrent.cpp',
|
||||
'libtorrent/src/torrent_handle.cpp',
|
||||
'libtorrent/src/torrent_info.cpp',
|
||||
'libtorrent/src/tracker_manager.cpp',
|
||||
'libtorrent/src/udp_tracker_connection.cpp',
|
||||
'libtorrent/src/web_peer_connection.cpp',
|
||||
'libtorrent/src/kademlia/closest_nodes.cpp',
|
||||
'libtorrent/src/kademlia/dht_tracker.cpp',
|
||||
'libtorrent/src/kademlia/find_data.cpp',
|
||||
'libtorrent/src/kademlia/node.cpp',
|
||||
'libtorrent/src/kademlia/node_id.cpp',
|
||||
'libtorrent/src/kademlia/refresh.cpp',
|
||||
'libtorrent/src/kademlia/routing_table.cpp',
|
||||
'libtorrent/src/kademlia/rpc_manager.cpp',
|
||||
'libtorrent/src/kademlia/traversal_algorithm.cpp'])
|
||||
|
||||
data = [('share/deluge/glade', glob.glob('glade/*.glade')),
|
||||
('share/deluge/pixmaps', glob.glob('pixmaps/*.png')),
|
||||
|
@ -94,6 +94,67 @@ data = [('share/deluge/glade', glob.glob('glade/*.glade')),
|
|||
for plugin in glob.glob('plugins/*'):
|
||||
data.append( ('share/deluge/' + plugin, glob.glob(plugin + '/*')) )
|
||||
|
||||
# Thanks to orra for code to save the location for installed prefix
|
||||
# At runtime, we need to know where we installed the data to.
|
||||
import shutil
|
||||
from distutils import cmd
|
||||
from distutils.command.install import install as _install
|
||||
|
||||
class write_data_install_path(cmd.Command):
|
||||
description = 'saves the data installation path for access at runtime'
|
||||
|
||||
def initialize_options(self):
|
||||
self.data_install_dir = None
|
||||
self.lib_build_dir = None
|
||||
|
||||
def finalize_options(self):
|
||||
self.set_undefined_options('install',
|
||||
('install_data', 'data_install_dir')
|
||||
)
|
||||
self.set_undefined_options('build',
|
||||
('build_lib', 'lib_build_dir')
|
||||
)
|
||||
|
||||
def run(self):
|
||||
conf_filename = os.path.join(self.lib_build_dir,
|
||||
'deluge', 'dcommon.py')
|
||||
|
||||
conf_file = open(conf_filename, 'r')
|
||||
data = conf_file.read()
|
||||
conf_file.close()
|
||||
data = data.replace('@datadir@', self.data_install_dir)
|
||||
|
||||
conf_file = open(conf_filename, 'w')
|
||||
conf_file.write(data)
|
||||
conf_file.close()
|
||||
|
||||
class unwrite_data_install_path(cmd.Command):
|
||||
description = 'undoes write_data_install_path'
|
||||
|
||||
def initialize_options(self):
|
||||
self.lib_build_dir = None
|
||||
|
||||
def finalize_options(self):
|
||||
self.set_undefined_options('build',
|
||||
('build_lib', 'lib_build_dir')
|
||||
)
|
||||
|
||||
def run(self):
|
||||
dest = os.path.join(self.lib_build_dir,
|
||||
'deluge', 'dcommon.py')
|
||||
shutil.copyfile('src/dcommon.py', dest)
|
||||
|
||||
class install(_install):
|
||||
sub_commands = [('write_data_install_path', None)] + \
|
||||
_install.sub_commands + [('unwrite_data_install_path', None)]
|
||||
|
||||
cmdclass = {
|
||||
'install': install,
|
||||
'write_data_install_path': write_data_install_path,
|
||||
'unwrite_data_install_path': unwrite_data_install_path,
|
||||
}
|
||||
|
||||
|
||||
setup(name="deluge", fullname="Deluge BitTorrent Client", version="0.4.90.2",
|
||||
author="Zach Tibbitts, Alon Zakai",
|
||||
author_email="zach@collegegeek.org, kripkensteiner@gmail.com",
|
||||
|
@ -104,6 +165,7 @@ setup(name="deluge", fullname="Deluge BitTorrent Client", version="0.4.90.2",
|
|||
packages=['deluge'],
|
||||
package_dir = {'deluge': 'src'},
|
||||
data_files=data,
|
||||
ext_package='deluge',
|
||||
ext_modules=[deluge_core]
|
||||
ext_package='deluge',
|
||||
ext_modules=[deluge_core],
|
||||
cmdclass=cmdclass
|
||||
)
|
||||
|
|
|
@ -28,9 +28,11 @@ PROGRAM_VERSION = "0.4.90.2"
|
|||
|
||||
CONFIG_DIR = xdg.BaseDirectory.save_config_path('deluge')
|
||||
|
||||
GLADE_DIR = sys.prefix + '/share/deluge/glade'
|
||||
PIXMAP_DIR = sys.prefix + '/share/deluge/pixmaps'
|
||||
PLUGIN_DIR = sys.prefix + '/share/deluge/plugins'
|
||||
# the necessary substitutions are made at installation time
|
||||
INSTALL_PREFIX = '@datadir@'
|
||||
GLADE_DIR = INSTALL_PREFIX + '/share/deluge/glade'
|
||||
PIXMAP_DIR = INSTALL_PREFIX + '/share/deluge/pixmaps'
|
||||
PLUGIN_DIR = INSTALL_PREFIX + '/share/deluge/plugins'
|
||||
|
||||
def estimate_eta(state):
|
||||
try:
|
||||
|
|
Loading…
Add table
Reference in a new issue