Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add all files and directories in tarball to debian/install #70

Merged
merged 1 commit into from Jun 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 3 additions & 42 deletions npm2deb/__init__.py
Expand Up @@ -231,48 +231,9 @@ def create_links(self):

def create_install(self):
content = ''
libs = {'package.json'}
if _os.path.isdir('bin'):
libs.add('bin')
if _os.path.isdir('lib'):
libs.add('lib')

# install files from directories field
if 'directories' in self.json:
directories = self.json['directories']
if 'bin' in directories:
libs.add(directories['bin'])
if 'lib' in directories:
libs.add(directories['lib'])

# install files from files field
if 'files' in self.json:
files = self.json['files']
# npm v1.4 returns string if files field has only one entry
if isinstance(files, str):
libs.add(files)
else:
libs = libs.union(files)

# install main if not in a subpath
if 'main' in self.json:
main = self.json['main']
main = _os.path.normpath(main)
if main == 'index':
main = 'index.js'
if not main.find('/') > 0:
libs.add(_os.path.normpath(main))
else:
if _os.path.exists('index.js'):
libs.add('index.js')
else:
libs.add('*.js')

# normalize filepaths
libs = set(map(lambda x: _os.path.normpath(x), libs))
# sanitize by removing current directory from files list
if '.' in libs:
libs.remove('.')
libs = _os.listdir()
# remove debian directory
libs.remove('debian')

for filename in libs:
content += "%s %s/\n" % (filename, self.debian_dest)
Expand Down