setup.py 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #!/usr/bin/env python
  2. #
  3. # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution
  4. # Copyright (C)2013-2016 Philemon <mmgen-py@yandex.com>
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. from distutils.core import setup,Extension
  19. from distutils.command.build_ext import build_ext
  20. from distutils.command.install_data import install_data
  21. import sys,os
  22. from shutil import copy2
  23. import subprocess as sp
  24. _gvi = sp.check_output(['gcc','--version']).splitlines()[0]
  25. have_mingw_64 = 'x86_64' in _gvi and 'MinGW' in _gvi
  26. # install extension module in repository after building
  27. class my_build_ext(build_ext):
  28. def build_extension(self,ext):
  29. build_ext.build_extension(self,ext)
  30. ext_src = self.get_ext_fullpath(ext.name)
  31. ext_dest = self.get_ext_filename(ext.name)
  32. try: os.unlink(ext_dest)
  33. except: pass
  34. os.chmod(ext_src,0755)
  35. print 'copying %s to %s' % (ext_src,ext_dest)
  36. copy2(ext_src,ext_dest)
  37. class my_install_data(install_data):
  38. def run(self):
  39. for f in 'mmgen.cfg','mnemonic.py','mn_wordlist.c':
  40. os.chmod(os.path.join('data_files',f),0644)
  41. install_data.run(self)
  42. module1 = Extension(
  43. name = 'mmgen.secp256k1',
  44. sources = ['extmod/secp256k1mod.c'],
  45. libraries = ['secp256k1'],
  46. library_dirs = ['/usr/local/lib',r'c:\msys\local\lib'],
  47. # mingw32 needs this, Linux can use it, but it breaks mingw64
  48. extra_link_args = (['-lgmp'],[])[have_mingw_64],
  49. include_dirs = ['/usr/local/include',r'c:\msys\local\include'],
  50. )
  51. from mmgen.globalvars import g
  52. setup(
  53. name = 'mmgen',
  54. description = 'A complete Bitcoin offline/online wallet solution for the command line',
  55. version = g.version,
  56. author = 'Philemon',
  57. author_email = 'mmgen-py@yandex.com',
  58. url = 'https://github.com/mmgen/mmgen',
  59. license = 'GNU GPL v3',
  60. platforms = 'Linux, MS Windows, Raspberry Pi',
  61. keywords = 'Bitcoin, cryptocurrency, wallet, cold storage, offline, online, spending, open-source, command-line, Python, Bitcoin Core, bitcoind, hd, deterministic, hierarchical, secure, anonymous, Electrum, seed, mnemonic, brainwallet, Scrypt, utility, script, scriptable, blockchain, raw, transaction, permissionless, console, terminal, curses, ansi, color, tmux, remote, client, daemon, RPC, json, entropy',
  62. cmdclass = { 'build_ext': my_build_ext, 'install_data': my_install_data },
  63. ext_modules = [module1],
  64. data_files = [('share/mmgen', [
  65. 'data_files/mmgen.cfg', # source files must have 0644 mode
  66. 'data_files/mn_wordlist.c',
  67. 'data_files/mnemonic.py'
  68. ]),],
  69. py_modules = [
  70. 'mmgen.__init__',
  71. 'mmgen.addr',
  72. 'mmgen.bitcoin',
  73. 'mmgen.color',
  74. 'mmgen.common',
  75. 'mmgen.crypto',
  76. 'mmgen.filename',
  77. 'mmgen.globalvars',
  78. 'mmgen.license',
  79. 'mmgen.mn_electrum',
  80. 'mmgen.mn_tirosh',
  81. 'mmgen.obj',
  82. 'mmgen.opts',
  83. 'mmgen.rpc',
  84. 'mmgen.seed',
  85. 'mmgen.term',
  86. 'mmgen.test',
  87. 'mmgen.tool',
  88. 'mmgen.tw',
  89. 'mmgen.tx',
  90. 'mmgen.util',
  91. 'mmgen.main',
  92. 'mmgen.main_addrgen',
  93. 'mmgen.main_addrimport',
  94. 'mmgen.main_tool',
  95. 'mmgen.main_txcreate',
  96. 'mmgen.main_txsend',
  97. 'mmgen.main_txsign',
  98. 'mmgen.main_wallet',
  99. 'mmgen.share.__init__',
  100. 'mmgen.share.Opts',
  101. ],
  102. scripts=[
  103. 'mmgen-addrgen',
  104. 'mmgen-keygen',
  105. 'mmgen-addrimport',
  106. 'mmgen-passchg',
  107. 'mmgen-walletchk',
  108. 'mmgen-walletconv',
  109. 'mmgen-walletgen',
  110. 'mmgen-txcreate',
  111. 'mmgen-txsign',
  112. 'mmgen-txsend',
  113. 'mmgen-tool'
  114. ]
  115. )