~noasakurajin/xapp/master

« back to all changes in this revision

Viewing changes to files/usr/bin/pastebin

  • Committer: Michael Webster
  • Author(s): worldofpeace
  • Date: 2020-01-08 03:33:00 UTC
  • Revision ID: git-v1:89ad087f22d9c5f3694585e6b5be5aa364de0e76
Install icons and scripts using meson options

With meson there's no point for a package to try to write to
'/' when there's built in options like 'bindir' and 'datadir' which
are the actual directories we want these files installed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python3
2
 
 
3
 
import sys
4
 
import os
5
 
import stat
6
 
import subprocess
7
 
 
8
 
content = ""
9
 
 
10
 
mode = os.fstat(0).st_mode
11
 
if stat.S_ISFIFO(mode):
12
 
    content = sys.stdin.read()
13
 
elif stat.S_ISREG(mode):
14
 
    content = sys.stdin.read()
15
 
else:
16
 
    args = sys.argv[1:]
17
 
    if len(args) == 1 and os.path.exists(args[0]):
18
 
        with open(args[0], 'r') as infile:
19
 
            content = infile.read()
20
 
    else:
21
 
        str_args = ' '.join(args)
22
 
        content = str_args
23
 
 
24
 
if content != "":
25
 
    if os.path.exists('/usr/bin/fpaste'):
26
 
        p = subprocess.Popen(['/usr/bin/fpaste'], stdin=subprocess.PIPE)
27
 
        p.communicate(content.encode("UTF-8"))
28
 
    else:
29
 
        p = subprocess.Popen(['nc', 'termbin.com', '9999'], stdin=subprocess.PIPE)
30
 
        p.communicate(content.encode("UTF-8"))